aboutsummaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
authorBryan C. Mills <bcmills@google.com>2022-09-09 17:29:12 -0400
committerGopher Robot <gobot@golang.org>2022-09-22 18:55:06 +0000
commit42a46206b97ca7cf4246d3c1230a70cf42ad5bb0 (patch)
tree21d66c4b23dbe41dae623a8cc009b389ece55903 /src/cmd
parent88a6a4d1ba75c01fcc7ab8b2b5c6108c36eb92b9 (diff)
downloadgo-42a46206b97ca7cf4246d3c1230a70cf42ad5bb0.tar.xz
cmd/go: omit VCS stamping during bootstrap
cmd/dist can't easily hard-code -buildvcs=false because not all versions of cmd/go supported for bootstrapping recognize that flag. However, we don't want to stamp the bootstrap binaries: the stamping is redundant with the VERSION file writted during bootstrapping (which is why it is normally omitted for standard-library packages and commands), and it may also interfere with building the Go repo from a source tarball or zip file. Fixes #54852. Change-Id: If223f094af137c4c202d6bf622619bd2da397ec4 Reviewed-on: https://go-review.googlesource.com/c/go/+/432435 Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Michael Matloob <matloob@golang.org> Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/go/internal/load/pkg.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/cmd/go/internal/load/pkg.go b/src/cmd/go/internal/load/pkg.go
index b1e4549d71..a6e380b89f 100644
--- a/src/cmd/go/internal/load/pkg.go
+++ b/src/cmd/go/internal/load/pkg.go
@@ -2441,6 +2441,12 @@ func (p *Package) setBuildInfo(autoVCS bool) {
}
if wantVCS && p.Module != nil && p.Module.Version == "" && !p.Standard {
+ if p.Module.Path == "bootstrap" && cfg.GOROOT == os.Getenv("GOROOT_BOOTSTRAP") {
+ // During bootstrapping, the bootstrap toolchain is built in module
+ // "bootstrap" (instead of "std"), with GOROOT set to GOROOT_BOOTSTRAP
+ // (so the bootstrap toolchain packages don't even appear to be in GOROOT).
+ goto omitVCS
+ }
repoDir, vcsCmd, err = vcs.FromDir(base.Cwd(), "", allowNesting)
if err != nil && !errors.Is(err, os.ErrNotExist) {
setVCSError(err)