Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enable DWARF debug info in the build by setting XCADDY_DEBUG=1 #62

Merged
merged 6 commits into from
Jul 3, 2021

Conversation

ggicci
Copy link
Contributor

@ggicci ggicci commented Jul 2, 2021

Fixes: #61

Allow building a debug output by setting XCADDY_DEBUG=1 for xcaddy command.

Examples:

XCADDY_DEBUG=1 xcaddy build --with github.com/xxx/xxx=$(pwd)
XCADDY_DEBUG=1 xcaddy run

@ggicci
Copy link
Contributor Author

ggicci commented Jul 2, 2021

How to Debug a Caddy Module under Development in VSCode

cd <your local repo>

# Build a caddy with your module and turns on debug info
XCADDY_DEBUG=1 xcaddy build --with github.com/ggicci/caddy-jwt=$( pwd ) --output ./caddy

In VSCode, create a launch.json:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Launch Caddy",
      "type": "go",
      "request": "launch",
      "mode": "exec",
      "program": "${workspaceFolder}/caddy", // the debug output of caddy
      "args": ["run", "-config=example/Caddyfile"],  // args to caddy
      "cwd": "${workspaceFolder}"
    }
  ]
}

Copy link
Member

@mholt mholt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does the entire readme need to be reformatted? Let's please just make the necessary changes.

How would this be used when running xcaddy in dev mode (i.e. not the build subcommand)? Why not use XCADDY_DEBUG env var instead that can work in both cases?

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@ggicci ggicci changed the title feat: add --debug option to build a debug output feat: introduce environment variable XCADDY_DEBUG to build a debug output Jul 3, 2021
@ggicci ggicci changed the title feat: introduce environment variable XCADDY_DEBUG to build a debug output feat: enable DWARF debug info in the build by setting XCADDY_DEBUG=1 Jul 3, 2021
@ggicci ggicci requested a review from mholt July 3, 2021 04:06
Copy link
Member

@mholt mholt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM now, thanks for the revisions!

@mholt mholt merged commit 8c5d3f1 into caddyserver:master Jul 3, 2021
@ggicci ggicci deleted the feat/add-debug-option branch July 4, 2021 05:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants