Files
garble/testdata/script/gotoolchain.txtar
Daniel Martí db3003b9fa use the correct toolchain "go" tool under GOTOOLCHAIN=auto
We call `go list` to collect information about all the packages
to obfuscate and build, which is crucial to be able to perform
obfuscation of names used across packages.

However, when GOTOOLCHAIN causes a toolchain upgrade,
we must ensure that we use the upgraded Go tool;
otherwise we are mixing information from different toolchain versions.

Fixes #934.
2025-03-31 01:34:31 +02:00

37 lines
912 B
Plaintext

# Test that garble works with transparent upgrades via GOTOOLCHAIN.
# We want to use the real GOPROXY so that we can download the newer
# toolchain, and we use the host's GOMODCACHE so we can reuse it.
setup-go go1.23.7
env GOPROXY=proxy.golang.org
env GOMODCACHE=${HOST_GOMODCACHE}
# Verify that we are using an older version of Go.
exec go version
stdout 'go version go1\.23\.7'
cd mod
# The builds inside the module use the upgraded toolchain.
exec go run .
stderr 'hello from go1\.24\.1'
# Note that garble hides runtime.Version by design, but we know that it requires
# the Go toolchain version to match the exact same version that built garble,
# and that version is most likely newer than GOVERSION_BASE.
exec garble run .
stderr 'hello from unknown'
-- mod/go.mod --
module test
go 1.24.1
-- mod/main.go --
package main
import "runtime"
func main() {
println("hello from", runtime.Version())
}