Run go test -tags in VSCode
10 Jan 2025 in TIL
I've been writing more Go recently, and the Go extension for VSCode provides an awesome Run Test button inline.
In many of our projects, we have a combination of unit and integration tests. To keep go test
quick, the integration tests have an integration
tag enabled. This means that the Run Test button doesn't work for integration tests.
To make them work, add the following to .vscode/settings.json
in your project:
json
{"go.testFlags": ["-v"],"go.testTags": "integration"}