mirror of
https://github.com/burrowers/garble.git
synced 2025-12-24 12:58:05 +08:00
support Go versions with X: suffixes for GOEXPERIMENTs
A workaround until https://github.com/golang/go/issues/75953 is fixed. See #978.
This commit is contained in:
committed by
Paul Scheduikat
parent
15a385283b
commit
37e582d581
3
main.go
3
main.go
@@ -731,6 +731,9 @@ To install Go, see: https://go.dev/doc/install
|
||||
if err := json.Unmarshal(out, &sharedCache.GoEnv); err != nil {
|
||||
return fmt.Errorf(`cannot unmarshal from "go env -json": %w`, err)
|
||||
}
|
||||
// TODO: remove once https://github.com/golang/go/issues/75953 is fixed,
|
||||
// such that `go env GOVERSION` can always be parsed by go/version.
|
||||
sharedCache.GoEnv.GOVERSION, _, _ = strings.Cut(sharedCache.GoEnv.GOVERSION, " ")
|
||||
|
||||
// Some Go version managers switch between Go versions via a GOROOT which symlinks
|
||||
// to one of the available versions. Given that later we build a patched linker
|
||||
|
||||
8
testdata/script/goversion.txtar
vendored
8
testdata/script/goversion.txtar
vendored
@@ -12,7 +12,7 @@ stderr 'Go version is too old; please upgrade to go1\.25\.0 or newer'
|
||||
# A clearly invalid go version.
|
||||
env TOOLCHAIN_GOVERSION='bogus version'
|
||||
! exec garble build
|
||||
stderr 'Go version "bogus version" appears to be invalid or too old; use go1\.25\.0 or newer'
|
||||
stderr 'Go version "bogus" appears to be invalid or too old; use go1\.25\.0 or newer'
|
||||
|
||||
# We should error on a devel version that's too old;
|
||||
# note that they started with the string "devel",
|
||||
@@ -49,6 +49,12 @@ env TOOLCHAIN_GOVERSION='go1.25.0-somecustomversion'
|
||||
! exec garble build
|
||||
stderr 'mocking the real build'
|
||||
|
||||
# A stable version with a build-time GOEXPERIMENT.
|
||||
# See: https://github.com/golang/go/issues/75953
|
||||
env TOOLCHAIN_GOVERSION='go1.25.0 X:nodwarf5'
|
||||
! exec garble build
|
||||
stderr 'mocking the real build'
|
||||
|
||||
# The current toolchain may be older than the one that built garble.
|
||||
env GARBLE_TEST_GOVERSION='go1.25.1'
|
||||
env TOOLCHAIN_GOVERSION='go1.25.0'
|
||||
|
||||
Reference in New Issue
Block a user