I have a repo in which multiple teams contribute integration tests.
All these tests are hidden behind //go:build integration
flags, so if I want go
to see or run them, I need to pass the -build integration
flag to the test command.
What I’m trying to accomplish is to compile all tests across the entirety of this repo without actually executing them (would take a long time) so I can catch build errors introduced by PRs that the default go test
compilation and execution would not catch.
I see the -c
flag:
-c Compile the test binary to pkg.test but do not run it (where pkg is the last element of the package's import path). The file name can be changed with the -o flag.
However… one cannot use the -c
flag with the -build
flag:
$ go test -build=integration -c ./integrationtests/client/admin-api
go: unknown flag -build=integration cannot be used with -c
Also... one cannot use the -c
flag across multiple packages:
$ go test -c ./...
cannot use -c flag with multiple packages
Any ideas?