英文:
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配置文件
英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论