Skip to content

Commit 6b05378

Browse files
committed
cmd/dist: set buildvcs=false when building go-bootstrap
When building go-bootstrap as part of the make.bash process, the cmd/dist invokes the bootstrap Go compiler to build the go_bootstrap tool: ${GOROOT_BOOTSTRAP}/bin/go install -tags=math_big_pure_go compiler_bootstrap purego bootstrap/cmd/... If there is an invalid .git directory in a parent of ${GOROOT_BOOTSTRAP}, make.bash will fail. Reproduction of the issue: mkdir go-issue-61620 cd ./go-issue-61620 wget https://go.dev/dl/go1.19.11.src.tar.gz mkdir go-bootstrap tar -xf go1.19.11.src.tar.gz -C ./go-bootstrap --strip-components=1 cd ./go-bootstrap/src/ bash make.bash cd ../../ wget https://go.dev/dl/go1.20.6.src.tar.gz mkdir go tar -xf go1.20.6.src.tar.gz -C ./go/ --strip-components=1 printf "gitdir: ../../does/not/exist/.git" > ./.git cd ./go/src/ GOROOT_BOOTSTRAP=$(pwd)/../../go-bootstrap/ bash make.bash The build fails with the following error: Building Go toolchain1 using [snip]/go-1.19.10. error obtaining VCS status: exit status 128 Use -buildvcs=false to disable VCS stamping. go tool dist: FAILED: [snip]/go-1.19.10/bin/go install -tags=math_big_pure_go \ compiler_bootstrap purego bootstrap/cmd/...: exit status 1 This change unconditionally sets -buildvcs=false when compiling go-bootstrap. We don't need the revision information in those binaries anyway. Setting this flag was previously not done as we were unsure if the go-bootstrap compiler would be new enough to support the buildvcs build flag. Since Go 1.20.x, Go 1.19.x is the minimum version for go-bootstrap, and supports -buildvcs=false. We can now set -buildvcs=false without worrying about compatibility. Related: #54852 Fixes: #61620
1 parent 737a5b0 commit 6b05378

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/cmd/dist/buildtool.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,9 @@ func bootstrapBuildTools() {
221221
cmd := []string{
222222
pathf("%s/bin/go", goroot_bootstrap),
223223
"install",
224+
// Fixes cases where an invalid .git is present in a parent of GOROOT_BOOTSTRAP.
225+
// See: https://github.com/golang/go/issues/61620
226+
"-buildvcs=false",
224227
"-tags=math_big_pure_go compiler_bootstrap purego",
225228
}
226229
if vflag > 0 {

0 commit comments

Comments
 (0)