Skip to content

Instantly share code, notes, and snippets.

@lawrencegripper
Last active January 10, 2024 21:25
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lawrencegripper/43f4bd28061181a593b0a08f348f2cef to your computer and use it in GitHub Desktop.
Save lawrencegripper/43f4bd28061181a593b0a08f348f2cef to your computer and use it in GitHub Desktop.
Golang debugging in VSCode with Arguments
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "go",
"request": "launch",
"mode": "debug",
"remotePath": "",
"port": 2345,
"host": "127.0.0.1",
"program": "${workspaceRoot}/cmd/traefik",
"env": {},
// The -- here is key, telling delve to pass arguments after it to your code
"args": ["--", "-c", "config.lgpriv.toml"],
// This controls the Working directory the code runs in, as my config.lgpriv.toml in my root
// I want the working dir to be the workspace root
"cwd": "${workspaceRoot}",
"showLog": true
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment