- set
launch.json
{
"name": "Attach",
"type": "go",
"request": "launch",
"mode": "remote",
"remotePath": "${workspaceRoot}",
"port": 2345,
"host": "127.0.0.1",
"program": "${workspaceRoot}",
"env": {},
"args": [],
"showLog": true
}
- go build && run
- get pid && dlv attach pid --headless --listen=:2345 --log
- in VSCode, Click begin debug button