diff options
author | Russ Cox <rsc@golang.org> | 2019-05-09 18:55:02 -0400 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2019-05-16 03:24:56 +0000 |
commit | 4f76871bd75530682964bd81d050e280c5309438 (patch) | |
tree | 4c4db07a7bbe1b21b4b7d5fa7cb3c39528266583 /src/cmd/go/internal/test/test.go | |
parent | 639ac76d453073da49a6a1d89b957cfa1bfef1af (diff) | |
download | go-4f76871bd75530682964bd81d050e280c5309438.tar.gz go-4f76871bd75530682964bd81d050e280c5309438.zip |
cmd/go: run full 'go vet' during 'go test' for packages in GOROOT
Now that the main tree complies with 'go vet', enable all vet checks
during 'go test' in the main tree. This helps surface helpful errors
while developing, instead of having to wait for the misc-vet-vetall builder.
During 'go test', the additional vet checks are essentially free:
the vet invocations themselves take only 8 seconds total for the entire tree.
Also update buildall.bash (used by the misc-compile builders)
to run 'go vet std cmd' for each GOOS/GOARCH pair.
This is not as free, since in general it can require recompiling
packages with their tests included before invoking vet.
(That compilation was going on anyway in the 'go test' case.)
On my Mac laptop, ./buildall.bash freebsd used to take
68+16+17+18 = 119 seconds for make.bash and then
the builds of the three freebsd architectures.
Now it takes 68+16+23+17+23+18+24 = 189 seconds, 60% longer.
Some of this is spent doing unnecessary cgo work.
Still, this lets us shard the vet checks and match all.bash.
Fixes #20119.
For #31916.
Change-Id: I6b0c40bac47708a688463c7fca12c0fc23ab2751
Reviewed-on: https://go-review.googlesource.com/c/go/+/176439
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/cmd/go/internal/test/test.go')
-rw-r--r-- | src/cmd/go/internal/test/test.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cmd/go/internal/test/test.go b/src/cmd/go/internal/test/test.go index fa6205918e..8440a83951 100644 --- a/src/cmd/go/internal/test/test.go +++ b/src/cmd/go/internal/test/test.go @@ -492,6 +492,9 @@ var ( testCacheExpire time.Time // ignore cached test results before this time ) +// testVetExplicit records whether testVetFlags were set by an explicit -vet. +var testVetExplicit = false + // testVetFlags is the list of flags to pass to vet when invoked automatically during go test. var testVetFlags = []string{ // TODO(rsc): Decide which tests are enabled by default. @@ -533,6 +536,7 @@ func runTest(cmd *base.Command, args []string) { work.BuildInit() work.VetFlags = testVetFlags + work.VetExplicit = testVetExplicit pkgs = load.PackagesForBuild(pkgArgs) if len(pkgs) == 0 { |