Go VS Code debugging FAQ

GO VS Code debug configuration

launch.json
{ "version": "0.2.0", "configurations": [ { "name": "Launch", "type": "go", "request": "launch", "mode": "debug", "remotePath": "", "port": 2345, "host": "127.0.0.1", "program": "${fileDirname}", "env": { "GOPATH":"D:\\Project Directory;D:\\Project Directory1;" }, "args": [], "showLog": true } ] }

 

Failded to continue:"Cannot find Delve debugger. Install from https://github.com/derekparker/delve & ensure it is in your "GOPATH/bin" or "PATH" 错误处理

or VS Code terminal: go  get github.com/derekparker/delve/cmd/dlv

 

 

Multi-project debugging

launch.json
        {
            "name": "Launch",
            "type": "go",
            "request": "launch",
            "mode": "debug",
            "remotePath": "",
            "port": 2345,
            "host": "127.0.0.1",
            "program": "${fileDirname}",
            "env": {
                "GOPATH":"E:\\GoFouxucPrivateRoomPorject\\"
            },
            "args": [],
            "showLog": true
        },
        {
            "name": "Launch2",
            "type": "go",
            "request": "launch2",
            "mode": "debug",
            "remotePath": "",
            "port": 2345,
            "host": "127.0.0.1",
            "program": "${fileDirname}",
            "env": {
                "GOPATH":"E:\\GoFouxucPrivateRoomPorject\\"
            },
            "args": [],
            "showLog": true
        }

  

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325126054&siteId=291194637