在VSCode中使用`-v`参数运行`go test`命令。

huangapple go评论116阅读模式
英文:

Run go test with `-v` in vscode

问题

我需要查看 t.Infof() 的输出,是否可以在 vscode 中使用 -v 运行 go test?

Run test 按钮没有添加 -v 参数,现在该怎么办?

英文:

I need to see the output from t.Infof(), is it possible to run go test with -v in vscode?

The Run test button does not add the -v parameter, what should I do now?

答案1

得分: 2

我相信VSCode有一个settings.json文件,你可以在其中添加以下内容:

"go.testFlags": ["-v"]

这样应该会将-v标志传递给go test

请注意,我不是VSCode的用户,但根据我记得回答的这个最近的问题,这应该是正确的方法。

另外,我相信VSCode确实有一个集成的终端,所以我可能会使用它来快速运行像go test -v -failfast -count=1 path/to/pkg... -run TestFooCaseA这样的命令,而不需要纠结于json配置文件 在VSCode中使用`-v`参数运行`go test`命令。

英文:

I believe VSCode has a settings.json file where you can add the following:

"go.testFlags": ["-v"]

which should pass the -v flag to go test.

Note that I'm not a VSCode user, but based on this recent question I remember answering, that should be the way to go.

Alternatively, I believe VSCode does have an integrated terminal, so I'd probably just use that to be able to quickly run things like go test -v -failfast -count=1 path/to/pkg... -run TestFooCaseA without faffing around with json config files 在VSCode中使用`-v`参数运行`go test`命令。

huangapple
  • 本文由 发表于 2022年10月19日 22:42:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/74127351.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定