Debugging Modules

Since compiling modules requires the xcaddy command, has anyone successfully setup the Goland (or VS Code) debugger to work with xcaddy? How are you debugging your Caddy modules if not using xcaddy?

I just use xcaddy with print statements in the code. (Sorry, I know it’s a non-answer to your question, but since I’ve probably used xcaddy more than anyone, I figure it’d be worth chiming in here.)

Use xcaddy build --with $(grep module go.mod | awk '{print $2}')=$PWD to make a binary from the root of your module project, then point the debugger to run your new caddy binary in your PWD. I’ve done this with VSCode a couple weeks ago, worked okay.

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.