Skip to content

Instantly share code, notes, and snippets.

@lawrencegripper
Last active March 2, 2023 09:12
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
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