]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.18] 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)
committerCherry Mui <cherryyz@google.com>
Mon, 4 Apr 2022 19:04:21 +0000 (19:04 +0000)
commitd17c5731ba38f9e031770cc104c8b218a6b5ece1
tree1264479f3605b9ff8f25c7f6cc72b86b4442939e
parentf4d55662d6f390ab853b121caddd91eff2692634
[release-branch.go1.18] 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 #51767.
Updates #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>
(cherry picked from commit 67f6b8c98715f265f38aff4052356ef6e6b35dfe)
Reviewed-on: https://go-review.googlesource.com/c/go/+/393878
Reviewed-by: Cherry Mui <cherryyz@google.com>
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]