]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.18] 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)
committerDmitri Shuralyov <dmitshur@golang.org>
Wed, 20 Apr 2022 16:33:28 +0000 (16:33 +0000)
commit24fcbb98080d1aea7d2ab101c3633a2fe2cda8c5
tree9404b58d9dc3ff6c346f8abe467b3d01920e1c46
parent0b0d2fe66d2348fa694a925595807859bf08a391
[release-branch.go1.18] 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.

Updates #51748.
Updates #51999.
Fixes #51798.

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>
(cherry picked from commit 4569fe64101c2209e3429bd1c953b5f4021fc43d)
Reviewed-on: https://go-review.googlesource.com/c/go/+/400454
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
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