go get -u github.com/go-delve/delve/cmd/dlv
我本人的launch.json (修改成你自己的路径):
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "go",
"request": "launch",
"mode": "debug",
"remotePath": "",
//"port": 2345,
//"host": "127.0.0.1",
"program": "/home/daji/data/codes/go_programming/src/daji-HelloGo/test.go",
"env": {
"GOPATH":"/home/daji/data/codes/go_programming"
},
"args": [],
"showLog": true
}
]
}
最后点下图的位置,就可以运行了。