Skip to content

Instantly share code, notes, and snippets.

@suhlig
Created June 4, 2022 16:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suhlig/09f9f3a3a817a376889d1c70dd0d4cad to your computer and use it in GitHub Desktop.
Save suhlig/09f9f3a3a817a376889d1c70dd0d4cad to your computer and use it in GitHub Desktop.
Use VS Code to debug a go program that is running externally
# see also https://github.com/go-delve/delve/tree/master/Documentation/api/dap
go build -o plaintweet-darwin \
&& dlv exec --headless --log --api-version 2 --listen localhost:42353 -- ./plaintweet-darwin serve
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach to Process",
"type": "go",
"request": "attach",
"mode": "remote",
"apiVersion": 2,
"port": 42353
},
]
}
@suhlig
Copy link
Author

suhlig commented Apr 4, 2023

For vim, this would be :GoDebugConnect :42353

see Vim, Go and Remote Debugging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment