Skip to content

Commit 607975c

Browse files
qiulaidongfenggopherbot
authored andcommitted
cmd/dist: enforce the lowest bootstrap version
The go1.24 release notes say that go1.22.6 is the minimum bootstraps required, the go team also use go1.22.6 bootstraps in testing, so if there's a problem with using an older version, automated testing won't uncover it. Now enforce this in dist to avoid release notes that do not match reality, which can be confusing. For #64751 Change-Id: Icd2f8a47b2bbb2d7c3dab9be9a228f43b9630063 GitHub-Last-Rev: 425cd7f GitHub-Pull-Request: #69168 Reviewed-on: https://go-review.googlesource.com/c/go/+/609762 Reviewed-by: David Chase <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Auto-Submit: Dmitri Shuralyov <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]>
1 parent 8014360 commit 607975c

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/cmd/dist/buildtool.go

+14-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ package main
1313

1414
import (
1515
"fmt"
16+
"go/version"
1617
"os"
1718
"path/filepath"
1819
"regexp"
@@ -118,9 +119,11 @@ var ignoreSuffixes = []string{
118119
"~",
119120
}
120121

122+
const minBootstrap = "go1.22.6"
123+
121124
var tryDirs = []string{
122-
"sdk/go1.22.6",
123-
"go1.22.6",
125+
"sdk/" + minBootstrap,
126+
minBootstrap,
124127
}
125128

126129
func bootstrapBuildTools() {
@@ -134,6 +137,15 @@ func bootstrapBuildTools() {
134137
}
135138
}
136139
}
140+
141+
// check bootstrap version.
142+
ver := run(pathf("%s/bin", goroot_bootstrap), CheckExit, pathf("%s/bin/go", goroot_bootstrap), "env", "GOVERSION")
143+
// go env GOVERSION output like "go1.22.6\n" or "devel go1.24-ffb3e574 Thu Aug 29 20:16:26 2024 +0000\n".
144+
ver = ver[:len(ver)-1]
145+
if version.Compare(ver, version.Lang(minBootstrap)) > 0 && version.Compare(ver, minBootstrap) < 0 {
146+
fatalf("%s does not meet the minimum bootstrap requirement of %s or later", ver, minBootstrap)
147+
}
148+
137149
xprintf("Building Go toolchain1 using %s.\n", goroot_bootstrap)
138150

139151
mkbuildcfg(pathf("%s/src/internal/buildcfg/zbootstrap.go", goroot))

0 commit comments

Comments
 (0)