]> Cypherpunks repositories - gostls13.git/commit
cmd/go: allow '-buildvcs=auto' and treat it as the default
authorBryan C. Mills <bcmills@google.com>
Thu, 7 Apr 2022 21:25:23 +0000 (17:25 -0400)
committerGopher Robot <gobot@golang.org>
Tue, 12 Apr 2022 20:22:45 +0000 (20:22 +0000)
commit4569fe64101c2209e3429bd1c953b5f4021fc43d
tree82cbe1609fc21cf0bf575af85b6c25d92482fc45
parent6f5590edf6883583a801ceb9309f074c0cd7c1cd
cmd/go: allow '-buildvcs=auto' and treat it as the default

When we added VCS stamping in the Go 1.18 release, we defaulted to
-buildvcs=true, on the theory that most folks will actually want VCS
information stamped.

We also made -buildvcs=true error out if a VCS directory is found and
no VCS tool is available, on the theory that a user who builds with
'-buildvcs=true' will be very surprised if the VCS metadata is
silently missing.

However, that causes a problem for CI environments that don't have the
appropriate VCS tool installed. (And we know that's a common situation
because we're in that situation ourselves — see #46693!)

The new '-buildvcs=auto' setting provides a middle ground: it stamps
VCS information by default when the tool is present (and reports
explicit errors if the tool errors out), but omits the metadata
when the tool isn't present at all.

Fixes #51748.
Updates #51999.

Change-Id: Iebc955c2af0abca9b7517f62ca48b1d944eb2df4
Reviewed-on: https://go-review.googlesource.com/c/go/+/398855
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/cmd/go/alldocs.go
src/cmd/go/internal/cfg/cfg.go
src/cmd/go/internal/list/list.go
src/cmd/go/internal/load/pkg.go
src/cmd/go/internal/work/build.go
src/cmd/go/testdata/script/build_buildvcs_auto.txt [new file with mode: 0644]
src/cmd/go/testdata/script/test_buildvcs.txt
src/cmd/go/testdata/script/version_buildvcs_nested.txt