Skip to content

Commit

Permalink
cmd/dist: enforce the lowest bootstrap version
Browse files Browse the repository at this point in the history
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 golang#64751

Change-Id: I8d50770e19f7f014e1316f0ac872e288a27c20fe
  • Loading branch information
qiulaidongfeng committed Aug 30, 2024
1 parent ffb3e57 commit afeed52
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/cmd/dist/buildtool.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ var tryDirs = []string{
"go1.22.6",
}

var minBootStrapVersion [3]string = [3]string{"1", "22", "6"}

func bootstrapBuildTools() {
goroot_bootstrap := os.Getenv("GOROOT_BOOTSTRAP")
if goroot_bootstrap == "" {
Expand All @@ -134,6 +136,19 @@ func bootstrapBuildTools() {
}
}
}

// check bootstrap version.
ver := run(pathf("%s/bin", goroot_bootstrap), CheckExit, pathf("%s/bin/go", goroot_bootstrap), "version")
_, after, _ := strings.Cut(ver, "go1")
if after != "" {
v := strings.Split(after, ".")
if len(v) > 2 {
if v[0] < minBootStrapVersion[1] || v[1] < minBootStrapVersion[2] {
fatalf("requires Go 1.%s.%s or later for bootstrap", minBootStrapVersion[1], minBootStrapVersion[2])
}
}
}

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

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

0 comments on commit afeed52

Please sign in to comment.