Skip to content

Commit afeed52

Browse files
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: I8d50770e19f7f014e1316f0ac872e288a27c20fe
1 parent ffb3e57 commit afeed52

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/cmd/dist/buildtool.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ var tryDirs = []string{
123123
"go1.22.6",
124124
}
125125

126+
var minBootStrapVersion [3]string = [3]string{"1", "22", "6"}
127+
126128
func bootstrapBuildTools() {
127129
goroot_bootstrap := os.Getenv("GOROOT_BOOTSTRAP")
128130
if goroot_bootstrap == "" {
@@ -134,6 +136,19 @@ func bootstrapBuildTools() {
134136
}
135137
}
136138
}
139+
140+
// check bootstrap version.
141+
ver := run(pathf("%s/bin", goroot_bootstrap), CheckExit, pathf("%s/bin/go", goroot_bootstrap), "version")
142+
_, after, _ := strings.Cut(ver, "go1")
143+
if after != "" {
144+
v := strings.Split(after, ".")
145+
if len(v) > 2 {
146+
if v[0] < minBootStrapVersion[1] || v[1] < minBootStrapVersion[2] {
147+
fatalf("requires Go 1.%s.%s or later for bootstrap", minBootStrapVersion[1], minBootStrapVersion[2])
148+
}
149+
}
150+
}
151+
137152
xprintf("Building Go toolchain1 using %s.\n", goroot_bootstrap)
138153

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

0 commit comments

Comments
 (0)