Home > Back-end >  Run go test with `-v` in vscode
Run go test with `-v` in vscode

Time:10-20

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?

CodePudding user response:

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 :)

  • Related