首页 > 解决方案 > 尝试在测试模式下在 VSCode 调试器上调试 golang 时出现奇怪的错误

问题描述

我正在Debug按下按钮VSCode

具有以下配置

{
    "version": "0.2.0",
    "configurations": [

        {
            "name": "Debug",
            "type": "go",
            "request": "launch",
            "mode": "debug",
            "program": "${workspaceRoot}",
                "env": {
                    "VAR1": "admin",
                    "VAR2": "supersecretpassword",
                    "VAR3": "doesnotmatter_1",
                    "VAR3": "doesnotmatter_2",
                },
        },
            {
                "name": "Test",
                "type": "go",
                "request": "launch",
                "mode": "test",
                "program": "${workspaceRoot}",
                "env": {
                    "VAR1": "admin",
                    "VAR2": "supersecretpassword",
                    "VAR3": "doesnotmatter_1",
                    "VAR4": "doesnotmatter_2",
                },
            }
    ]
}

(我正在选择Test模式

我一生中第一次收到以下错误:

启动失败:无法启动进程:打开/Users/pantelis/Workspace/eck-user-mgmt/__debug_bin:没有这样的文件或目录

我很确定我最多在几天前运行这个过程。

有任何想法吗?

(选择Debug模式时,该过程似乎按预期工作)

编辑1:我将Test配置更改为以下

                "name": "Test",
                "type": "go",
                "request": "launch",
                "mode": "test",
                "program": "${workspaceRoot}",
                "env": {
                    "VAR1": "admin",
                    "VAR2": "supersecretpassword",
                    "VAR3": "doesnotmatter_1",
                    "VAR4": "doesnotmatter_2",
                    "trace": "verbose",
                    "showLog": true,
                    "logOutput": "dap",
                },
            }

它仍然失败但没有特别的错误(或DEBUG CONSOLE输出视图中的额外信息

在此处输入图像描述

在此处输入图像描述

标签: godebuggingvisual-studio-code

解决方案


推荐阅读