Skip to content

Commit 9287edb

Browse files
new
Change-Id: I8f97788fd8a4edb24c44c8e9976039945fb242ec
1 parent d574061 commit 9287edb

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

src/cmd/dist/buildtool.go

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,11 @@ var ignoreSuffixes = []string{
119119
"~",
120120
}
121121

122+
const minBootstrap = "go1.22.6"
123+
122124
var tryDirs = []string{
123-
"sdk/go1.22.6",
124-
"go1.22.6",
125+
"sdk/" + minBootstrap,
126+
minBootstrap,
125127
}
126128

127129
func bootstrapBuildTools() {
@@ -137,16 +139,11 @@ func bootstrapBuildTools() {
137139
}
138140

139141
// check bootstrap version.
140-
ver := run(pathf("%s/bin", goroot_bootstrap), CheckExit, pathf("%s/bin/go", goroot_bootstrap), "version")
141-
// go version output like go version 1.22.6 goos/aoarch,
142-
// or go version devel go1.24-b44ca2cd85.
143-
vers := strings.Split(ver, " ")
144-
ver = vers[2]
145-
if vers[2] == "devel" {
146-
ver = vers[3]
147-
}
148-
if version.Compare(ver, tryDirs[1]) == -1 {
149-
fatalf("requires %s or later for bootstrap", tryDirs[1])
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 (strings.Contains(ver, "devel") && version.Compare(version.Lang(minBootstrap), ver) == 1) || version.Compare(ver, minBootstrap) == -1 {
146+
fatalf("%s does not meet the minimum bootstrap requirement of %s or later", ver, minBootstrap)
150147
}
151148

152149
xprintf("Building Go toolchain1 using %s.\n", goroot_bootstrap)

0 commit comments

Comments
 (0)