-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Description
Hi,
On windows gotip download always computes GOROOT_BOOTSTRAP, even if it already exists, using go env GOROOT:
https://cs.opensource.google/go/dl/+/5216546b:internal/version/gotip.go;l=152-158
In the case the go executable available in PATH variable is older than 1.17.13, the build fails with a message like:
Building Go cmd/dist using D:\some\path\go. (go1.15.15 windows/amd64)
found packages main (build.go) and building_Go_requires_Go_1_17_13_or_later (notgo117.go) in C:\Users\runneradmin\sdk\gotip\src\cmd\dist
Of course PATH variable can be modified just before launching gotip download to prepend the path of a more recent go, but shouldn't it be cleaner to use GOROOT_BOOTSTRAP to solve this? and so to compute GOROOT_BOOTSTRAP only if it is not already defined, as in:
https://cs.opensource.google/go/dl/+/5216546b:internal/version/gotip.go;l=152
- if runtime.GOOS == "windows" {
+ if runtime.GOOS == "windows" && os.Getenv("GOROOT_BOOTSTRAP") == "" {This way we can define GOROOT_BOOTSTRAP, before launching gotip download, on windows as we do on other platforms, without requiring PATH manipulation specifically on windows.