VSCode远程调试Go程序方法(Attach)
- 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
文章来自:https://www.cnblogs.com/mrblue/p/9069084.html