相关疑难解决方法(0)

在Visual Studio代码中调试Go测试

在我的Windows机器上,我安装了Visual Studio代码.要手动运行测试,我将进入项目文件夹并输入

go test main_test.go
Run Code Online (Sandbox Code Playgroud)

它完美地运作.

在此输入图像描述

但我有一种情况需要调试我的测试以了解正在发生的事情.

为此,我打开launch.json并添加配置

  {
        "name": "Tests",
        "type": "go",
        "request": "launch",
        "mode": "test",
        "remotePath": "",
        "port": 2346,
        "host": "127.0.0.1",
        "program": "${workspaceRoot}",
        "env": {},
        "args": [
           "main_test.go"
            ],
        "showLog": true
    }
Run Code Online (Sandbox Code Playgroud)

按完F5后,我有

2017/03/29 13:28:11 server.go:73: Using API v1
2017/03/29 13:28:11 debugger.go:68: launching process with args: [./debug.test main_test.go main_go]
not an executable file
Process exiting with code: 1
Run Code Online (Sandbox Code Playgroud)

任何想法为什么会出现这个错误以及它正在寻找什么可执行文件?

unit-testing go visual-studio-code

5
推荐指数
1
解决办法
5320
查看次数

标签 统计

go ×1

unit-testing ×1

visual-studio-code ×1