dqwcdqs358367
2019-02-13 16:16 阅读 59
已采纳

如何使用vscode调试go 1.11.x

I am new to golang, but working on go 1.11.x.

My team use go module. The first time I clone the repository, I need to run GO111MODULE=on go mod download to download dependencies modules.

Then I need to run GO111MODULE=on go run main.go to run my app.

There is no one use vscode debugger, they prefer console log instead.

Is there any way to debug go 1.11.x using vscode?

Thanks.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • 已采纳
    douquanzhan0315 douquanzhan0315 2019-02-14 03:25

    I found the root cause right now. It is the source code of my team, not related to vscode or go 1.11.

    My working launch.json is here

    {
        "version": "0.2.0",
        "configurations": [
    
            {
                "name": "Go debug",
                "type": "go",
                "request": "launch",
                "mode": "debug",
                "remotePath": "",
                "port": 2345,
                "host": "127.0.0.1",
                "program": "${workspaceRoot}/main.go",
                "env": {
                //   "GO111MODULE": "on"
                },
                "args": [],
                "showLog": true
            }
        ]
    }
    
    点赞 评论 复制链接分享

相关推荐