]> Cypherpunks repositories - gostls13.git/commit
cmd/go: avoid stamping VCS metadata in test binaries
authorBryan C. Mills <bcmills@google.com>
Fri, 18 Mar 2022 15:40:34 +0000 (11:40 -0400)
committerBryan Mills <bcmills@google.com>
Fri, 18 Mar 2022 21:26:31 +0000 (21:26 +0000)
commit67f6b8c98715f265f38aff4052356ef6e6b35dfe
tree73ca63afa97644aade3722149cdaa80ee68a5cfd
parent9465878114232d4a9cd755fee9241fff1d63bbea
cmd/go: avoid stamping VCS metadata in test binaries

Invoking a VCS tool requires that the VCS tool be installed, and also
adds latency to build commands. Unfortunately, we had been mistakenly
loading VCS metadata for tests of "main" packages.

Users almost never care about versioning for test binaries, because
'go test' runs the test in the source tree and test binaries are only
rarely used outside of 'go test'. So the user already knows exactly
which version the test is built against, because the source code is
right there — it's not worth the overhead to stamp.

Fixes #51723.

Change-Id: I96f191c5a765f5183e5e10b6dfb75a0381c99814
Reviewed-on: https://go-review.googlesource.com/c/go/+/393894
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Trust: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/cmd/go/internal/list/list.go
src/cmd/go/internal/load/pkg.go
src/cmd/go/internal/load/test.go
src/cmd/go/internal/work/build.go
src/cmd/go/testdata/script/test_buildvcs.txt [new file with mode: 0644]