]> Cypherpunks repositories - gostls13.git/commit
cmd/go: rebuild as needed when vetting test packages
authorNikhil Benesch <nikhil.benesch@gmail.com>
Tue, 3 Apr 2018 04:35:46 +0000 (00:35 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 4 Apr 2018 14:39:23 +0000 (14:39 +0000)
commit804d03281c04096fca7f73dc33d1d62e09a86892
treefd488f330358cd7ac07c90155614934f8236fbb8
parentf2abca90a20b57a552dbdaa7ac739e990fc9bc94
cmd/go: rebuild as needed when vetting test packages

If A's external test package imports B, which imports A, and A's
internal test code adds something to A that invalidates anything in A's
export data, then we need to build B against the test-augmented version
of A before using it to build A's external test package.

https://golang.org/cl/92215 taught 'go test' to do this rebuilding
properly, but 'go vet' was not taught the same trick when it learned to
vet test packages in https://golang.org/cl/87636. This commit moves the
necessary logic into the load.TestPackagesFor function so it can be
shared by 'go test' and 'go vet'.

Fixes #23701.

Change-Id: I1086d447eca02933af53de693384eac99a08d9bd
Reviewed-on: https://go-review.googlesource.com/104315
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
src/cmd/go/go_test.go
src/cmd/go/internal/load/pkg.go
src/cmd/go/internal/test/test.go