VSCode在带有启动配置的文件夹中运行所有go测试



我正在尝试进行启动配置,该配置将运行我在repo中特定文件夹中的所有go测试。

我可以在终端中成功运行go test ./src/...以运行我关心的所有测试,但在VSCode启动配置中复制时遇到麻烦。

这是我当前的启动配置:

{
"name": "run tests",
"type": "go",
"request": "launch",
"mode": "test",
"args": ["./src..."],
"program": "${workspaceFolder}",
}

似乎使用./src/...作为参数的行为不像我期望的那样。使用这个启动配置,我得到一个错误:

no Go files in /home/paymahn/gadic/backend
exit status 1
Process exiting with code: 1

是否有一种方法来复制go test ./src/...作为VSCode启动配置?

当我尝试运行一个简单的测试时,我使用这个设置,参考这里。

{
"name": "Tests",
"type": "go",
"request": "launch",
"mode": "test",
"remotePath": "",
"program": "${fileDirname}",
"env": {},
"args": ["^TestGenerateConfigurationFailure$"]
}

关于具体的文件夹,我理解Golang测试工具检查的是"test";模块方案。不,是Golang测试工具的特定regex名称文件夹。

你可以在Golang的官方调试VS-Code中查看更多信息