cmd/dist: require Go 1.22.6 as minimum bootstrap toolchain

This is a minimal change to start to require the new minimum bootstrap.
Taking advantage of the newer bootstap to simplify and improve code is
left to be done in separate CLs.

For #64751.

Change-Id: I1d4f883fae3026354a199174d51e79a36cd2dc53
Reviewed-on: https://go-review.googlesource.com/c/go/+/606156
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Dmitri Shuralyov 2024-08-16 14:01:15 -04:00 committed by Gopher Robot
parent 4e1cc09f8b
commit a4cb37d4af
6 changed files with 20 additions and 15 deletions

View File

@ -4,4 +4,9 @@
## Linker {#linker} ## Linker {#linker}
## Bootstrap {#bootstrap}
<!-- go.dev/issue/64751 -->
As mentioned in the [Go 1.22 release notes](/doc/go1.22#bootstrap), Go 1.24 now requires
Go 1.22.6 or later for bootstrap.
We expect that Go 1.26 will require a point release of Go 1.24 or later for bootstrap.

10
src/cmd/dist/README vendored
View File

@ -4,16 +4,16 @@ As of Go 1.5, dist and other parts of the compiler toolchain are written
in Go, making bootstrapping a little more involved than in the past. in Go, making bootstrapping a little more involved than in the past.
The approach is to build the current release of Go with an earlier one. The approach is to build the current release of Go with an earlier one.
The process to install Go 1.x, for x ≥ 22, is: The process to install Go 1.x, for x ≥ 24, is:
1. Build cmd/dist with Go 1.20.6. 1. Build cmd/dist with Go 1.22.6.
2. Using dist, build Go 1.x compiler toolchain with Go 1.20.6. 2. Using dist, build Go 1.x compiler toolchain with Go 1.22.6.
3. Using dist, rebuild Go 1.x compiler toolchain with itself. 3. Using dist, rebuild Go 1.x compiler toolchain with itself.
4. Using dist, build Go 1.x cmd/go (as go_bootstrap) with Go 1.x compiler toolchain. 4. Using dist, build Go 1.x cmd/go (as go_bootstrap) with Go 1.x compiler toolchain.
5. Using go_bootstrap, build the remaining Go 1.x standard library and commands. 5. Using go_bootstrap, build the remaining Go 1.x standard library and commands.
Because of backward compatibility, although the steps above say Go 1.20.6, Because of backward compatibility, although the steps above say Go 1.22.6,
in practice any release ≥ Go 1.20.6 but < Go 1.x will work as the bootstrap base. in practice any release ≥ Go 1.22.6 but < Go 1.x will work as the bootstrap base.
Releases ≥ Go 1.x are very likely to work as well. Releases ≥ Go 1.x are very likely to work as well.
See https://go.dev/s/go15bootstrap for more details about the original bootstrap See https://go.dev/s/go15bootstrap for more details about the original bootstrap

View File

@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// Go 1.22 and later requires Go 1.20 as the bootstrap toolchain. // Go 1.24 and later requires Go 1.22.6 as the bootstrap toolchain.
// If cmd/dist is built using an earlier Go version, this file will be // If cmd/dist is built using an earlier Go version, this file will be
// included in the build and cause an error like: // included in the build and cause an error like:
// //
// % GOROOT_BOOTSTRAP=$HOME/sdk/go1.16 ./make.bash // % GOROOT_BOOTSTRAP=$HOME/sdk/go1.16 ./make.bash
// Building Go cmd/dist using /Users/rsc/sdk/go1.16. (go1.16 darwin/amd64) // Building Go cmd/dist using /Users/rsc/sdk/go1.16. (go1.16 darwin/amd64)
// found packages main (build.go) and building_Go_requires_Go_1_20_6_or_later (notgo120.go) in /Users/rsc/go/src/cmd/dist // found packages main (build.go) and building_Go_requires_Go_1_22_6_or_later (notgo122.go) in /Users/rsc/go/src/cmd/dist
// % // %
// //
// which is the best we can do under the circumstances. // which is the best we can do under the circumstances.
@ -16,6 +16,6 @@
// See go.dev/issue/44505 for more background on // See go.dev/issue/44505 for more background on
// why Go moved on from Go 1.4 for bootstrap. // why Go moved on from Go 1.4 for bootstrap.
//go:build !go1.20 //go:build !go1.22
package building_Go_requires_Go_1_20_6_or_later package building_Go_requires_Go_1_22_6_or_later

View File

@ -64,14 +64,14 @@
# timing information to this file. Useful for profiling where the # timing information to this file. Useful for profiling where the
# time goes when these scripts run. # time goes when these scripts run.
# #
# GOROOT_BOOTSTRAP: A working Go tree >= Go 1.20.6 for bootstrap. # GOROOT_BOOTSTRAP: A working Go tree >= Go 1.22.6 for bootstrap.
# If $GOROOT_BOOTSTRAP/bin/go is missing, $(go env GOROOT) is # If $GOROOT_BOOTSTRAP/bin/go is missing, $(go env GOROOT) is
# tried for all "go" in $PATH. By default, one of $HOME/go1.20.6, # tried for all "go" in $PATH. By default, one of $HOME/go1.22.6,
# $HOME/sdk/go1.20.6, or $HOME/go1.4, whichever exists, in that order. # $HOME/sdk/go1.22.6, or $HOME/go1.4, whichever exists, in that order.
# We still check $HOME/go1.4 to allow for build scripts that still hard-code # We still check $HOME/go1.4 to allow for build scripts that still hard-code
# that name even though they put newer Go toolchains there. # that name even though they put newer Go toolchains there.
bootgo=1.20.6 bootgo=1.22.6
set -e set -e

View File

@ -85,7 +85,7 @@ for /f "tokens=*" %%g in ('where go 2^>nul') do (
) )
) )
set bootgo=1.20.6 set bootgo=1.22.6
if "x%GOROOT_BOOTSTRAP%"=="x" if exist "%HOMEDRIVE%%HOMEPATH%\go%bootgo%" set GOROOT_BOOTSTRAP=%HOMEDRIVE%%HOMEPATH%\go%bootgo% if "x%GOROOT_BOOTSTRAP%"=="x" if exist "%HOMEDRIVE%%HOMEPATH%\go%bootgo%" set GOROOT_BOOTSTRAP=%HOMEDRIVE%%HOMEPATH%\go%bootgo%
if "x%GOROOT_BOOTSTRAP%"=="x" if exist "%HOMEDRIVE%%HOMEPATH%\sdk\go%bootgo%" set GOROOT_BOOTSTRAP=%HOMEDRIVE%%HOMEPATH%\sdk\go%bootgo% if "x%GOROOT_BOOTSTRAP%"=="x" if exist "%HOMEDRIVE%%HOMEPATH%\sdk\go%bootgo%" set GOROOT_BOOTSTRAP=%HOMEDRIVE%%HOMEPATH%\sdk\go%bootgo%
if "x%GOROOT_BOOTSTRAP%"=="x" set GOROOT_BOOTSTRAP=%HOMEDRIVE%%HOMEPATH%\Go1.4 if "x%GOROOT_BOOTSTRAP%"=="x" set GOROOT_BOOTSTRAP=%HOMEDRIVE%%HOMEPATH%\Go1.4

View File

@ -48,7 +48,7 @@ fn bootstrapenv {
GOROOT=$GOROOT_BOOTSTRAP GO111MODULE=off GOENV=off GOOS=() GOARCH=() GOEXPERIMENT=() GOFLAGS=() $* GOROOT=$GOROOT_BOOTSTRAP GO111MODULE=off GOENV=off GOOS=() GOARCH=() GOEXPERIMENT=() GOFLAGS=() $*
} }
bootgo = 1.20.6 bootgo = 1.22.6
GOROOT = `{cd .. && pwd} GOROOT = `{cd .. && pwd}
goroot_bootstrap_set = 'true' goroot_bootstrap_set = 'true'
if(! ~ $#GOROOT_BOOTSTRAP 1){ if(! ~ $#GOROOT_BOOTSTRAP 1){