Wednesday, November 29, 2017

visual code add quick debug profile to go lang project

visual code add quick debug profile to go lang project

how to it:
in vs code > vscode/launch.json file, add below code:    (or used left debug panel > add profile)

    {
        "name": "xg",
        "type": "go",
        "request": "launch",
        "mode": "debug",
        "remotePath": "",
        "port": 8086,
        "host": "127.0.0.1",
        "program": "${env:GOPATH}/src/sx98/xg/main.go",
        "cwd": "${env:GOPATH}/src/sx98/xg/",
        "env": {},
        "args": [],
        "showLog": true
    }

Then, in left debug panel, choose "xg", now can debug quickly. From now, no need locate to "src/sx98/xg/main.go" and press F5.


No comments: