简体   繁体   English

如何使用vscode调试go 1.11.x

[英]how to use vscode to debug go 1.11.x

I am new to golang, but working on go 1.11.x. 我是golang的新手,但正在研究go1.11.x。

My team use go module . 我的团队使用go module The first time I clone the repository, I need to run GO111MODULE=on go mod download to download dependencies modules. 第一次克隆存储库时,我需要运行GO111MODULE=on go mod download来下载依赖项模块。

Then I need to run GO111MODULE=on go run main.go to run my app. 然后,我需要运行GO111MODULE=on go run main.go来运行我的应用程序。

There is no one use vscode debugger, they prefer console log instead. 没有人使用vscode调试器,他们更喜欢控制台日志。

Is there any way to debug go 1.11.x using vscode? 有什么方法可以使用vscode调试go 1.11.x吗?

Thanks. 谢谢。

I found the root cause right now. 我现在找到了根本原因。 It is the source code of my team, not related to vscode or go 1.11. 它是我团队的源代码,与vscode或go 1.11无关。

My working launch.json is here 我正在工作的launch.json在这里

{
    "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
        }
    ]
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM