直接上解决方案:
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
        }
    ]
}

最后点下图的位置,就可以运行了。

在这里插入图片描述