原来的launch.json
json
{
"version": "0.2.0",
"configurations": [
{
"name": "Golang",
"type": "go",
"request": "launch",
"program": "${workspaceFolder}",
"args": []
}
]
}
如果报以下错误:
Couldn't start dlv dap:
Error:Cannot find Delve debugger (dlv dap)
需要安装github.com/go-delve/delve/cmd/dlv
go版本1.16以上,执行
shell
go install github.com/go-delve/delve/cmd/dlv@latest
1.16以下
shell
go get github.com/go-delve/delve/cmd/dlv
安装完成后就可以DEBUG了