drop Go 1.22 and require Go 1.23.0 or later (#876)

This lets us start taking advantage of featurs from Go 1.23,
particularly tracking aliases in go/types and iterators.

Note that we need to add code to properly handle or skip over the new
*types.Alias type which go/types produces for Go type aliases.
Also note that we actually turn this mode off entirely for now,
due to the bug reported at https://go.dev/issue/70394.

We don't yet remove our own alias tracking code yet due to the above.
We hope to be able to remove it very soon.
This commit is contained in:
Daniel Martí
2024-11-17 15:06:57 +00:00
committed by GitHub
parent 69d7b84f35
commit 30357af923
44 changed files with 101 additions and 303 deletions
+1 -1
View File
@@ -33,7 +33,7 @@ binsubstr main$exe 'addJmp' 'AddImpl'
-- go.mod --
module test/with.many.dots/main
go 1.22
go 1.23
-- main.go --
package main
+1 -1
View File
@@ -18,7 +18,7 @@ cmp stderr main.stderr
-- go.mod --
module test/main
go 1.22
go 1.23
-- main.go --
package main
+1 -1
View File
@@ -59,7 +59,7 @@ binsubstr main$exe 'garble_main.go' 'globalVar' 'globalFunc' $gofullversion
-- go.mod --
module test/mainfoo
go 1.22
go 1.23
-- garble_main.go --
package main
+1 -1
View File
@@ -28,7 +28,7 @@ cmp stderr main.stderr
-- go.mod --
module test/main
go 1.22
go 1.23
-- main.go --
package main
+1 -1
View File
@@ -29,7 +29,7 @@ binsubstr main$exe 'privateAdd'
-- go.mod --
module test/main
go 1.22
go 1.23
-- main.go --
package main
+1 -1
View File
@@ -31,7 +31,7 @@ exec garble build
-- go.mod --
module test/main
go 1.22
go 1.23
-- main.go --
package main
+1 -1
View File
@@ -30,7 +30,7 @@ grep 'func\(int\) int' $WORK/debug/test/main/GARBLE_controlflow.go
-- go.mod --
module test/main
go 1.22
go 1.23
-- garble_main.go --
package main
+1 -1
View File
@@ -18,7 +18,7 @@ stderr 'test/main' # we force rebuilds with -debugdir
-- go.mod --
module test/main
go 1.22
go 1.23
-- main.go --
package main
+1 -1
View File
@@ -11,7 +11,7 @@ cmp stdout main.stdout
-- go.mod --
module test/main
go 1.22
go 1.23
-- main.go --
package main
+1 -1
View File
@@ -46,7 +46,7 @@ exec $NAME/garble$exe build
-- go.mod --
module test/main
go 1.22
go 1.23
-- main.go --
package main
+1 -1
View File
@@ -54,7 +54,7 @@ bincmp out_rebuild out
-- go.mod --
module test/main
go 1.22
go 1.23
-- standalone/main.go --
package main
+18 -18
View File
@@ -7,30 +7,30 @@ env PATH=${WORK}/.bin${:}${PATH}
# An empty go version.
env TOOLCHAIN_GOVERSION=''
! exec garble build
stderr 'Go version is too old; please upgrade to go1\.22 or newer'
stderr 'Go version is too old; please upgrade to go1\.23 or newer'
# We should error on a devel version that's too old.
# Note that they lacked the "goN.M-" prefix.
env TOOLCHAIN_GOVERSION='devel +afb5fca Sun Aug 07 00:00:00 2020 +0000'
! exec garble build
stderr 'Go version is too old; please upgrade to go1\.22 or newer'
stderr 'Go version is too old; please upgrade to go1\.23 or newer'
# Another form of old version; with an old "goN.M-" prefix.
env TOOLCHAIN_GOVERSION='devel go1.15-afb5fca Sun Aug 07 00:00:00 2020 +0000'
! exec garble build
stderr 'Go version "devel go1\.15-.*2020.*" is too old; please upgrade to go1\.22'
stderr 'Go version "devel go1\.15-.*2020.*" is too old; please upgrade to go1\.23'
# A current devel version should be fine.
# Note that we don't look at devel version timestamps.
env GARBLE_TEST_GOVERSION='go1.22'
env TOOLCHAIN_GOVERSION='devel go1.22-ad97d204f0 Sun Sep 12 16:46:58 2023 +0000'
env GARBLE_TEST_GOVERSION='go1.23.0'
env TOOLCHAIN_GOVERSION='devel go1.23-ad97d204f0 Sun Sep 12 16:46:58 2023 +0000'
! exec garble build
stderr 'mocking the real build'
# We should error on a stable version that's too old.
env TOOLCHAIN_GOVERSION='go1.14'
! exec garble build
stderr 'Go version "go1\.14" is too old; please upgrade to go1\.22 or newer'
stderr 'Go version "go1\.14" is too old; please upgrade to go1\.23 or newer'
# We should reject a future stable version, as we don't have linker patches yet.
# Note that we need to bump the version of Go that supposedly built it, too.
@@ -40,45 +40,45 @@ env TOOLCHAIN_GOVERSION='go1.28.2'
stderr 'Go version "go1\.28\.2" is too new; Go linker patches aren''t available for go1\.24 or later yet'
# We should accept custom devel strings.
env TOOLCHAIN_GOVERSION='devel go1.22-somecustomversion'
env TOOLCHAIN_GOVERSION='devel go1.23-somecustomversion'
! 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.23'
env TOOLCHAIN_GOVERSION='go1.22.3'
env GARBLE_TEST_GOVERSION='go1.23.2'
env TOOLCHAIN_GOVERSION='go1.23.1'
! exec garble build
stderr 'mocking the real build'
# The current toolchain may be equal to the one that built garble.
env GARBLE_TEST_GOVERSION='devel go1.22-6673d5d701 Sun Mar 20 16:05:03 2023 +0000'
env TOOLCHAIN_GOVERSION='devel go1.22-6673d5d701 Sun Mar 20 16:05:03 2023 +0000'
env GARBLE_TEST_GOVERSION='devel go1.23-6673d5d701 Sun Mar 20 16:05:03 2023 +0000'
env TOOLCHAIN_GOVERSION='devel go1.23-6673d5d701 Sun Mar 20 16:05:03 2023 +0000'
! exec garble build
stderr 'mocking the real build'
# The current toolchain must not be newer than the one that built garble.
env GARBLE_TEST_GOVERSION='go1.18'
env TOOLCHAIN_GOVERSION='go1.22.1'
env TOOLCHAIN_GOVERSION='go1.23.1'
! exec garble build
stderr 'garble was built with "go1\.18" and can''t be used with the newer "go1\.22\.1"; rebuild '
stderr 'garble was built with "go1\.18" and can''t be used with the newer "go1\.23\.1"; rebuild '
# We'll error even if the difference is a minor (bugfix) level.
# In practice it probably wouldn't matter, but in theory it could still lead to tricky bugs.
env GARBLE_TEST_GOVERSION='go1.22.11'
env TOOLCHAIN_GOVERSION='go1.22.14'
env GARBLE_TEST_GOVERSION='go1.23.11'
env TOOLCHAIN_GOVERSION='go1.23.14'
! exec garble build
stderr 'garble was built with "go1\.22\.11" and can''t be used with the newer "go1\.22\.14"; rebuild '
stderr 'garble was built with "go1\.23\.11" and can''t be used with the newer "go1\.23\.14"; rebuild '
# If garble builds itself and is then used, it won't know what version built it.
# As a fallback, we drop the comparison against the toolchain's version.
env GARBLE_TEST_GOVERSION='bogus version'
env TOOLCHAIN_GOVERSION='go1.22.3'
env TOOLCHAIN_GOVERSION='go1.23.3'
! exec garble build
stderr 'mocking the real build'
-- go.mod --
module test/main
go 1.22
go 1.23
-- main.go --
package main
+1 -1
View File
@@ -117,6 +117,6 @@ stderr 'usage: garble version'
-- go.mod --
module dummy
go 1.22
go 1.23
-- dummy.go --
package dummy
+1 -1
View File
@@ -13,7 +13,7 @@ cmp stdout main.stdout
-- go.mod --
module test/main
go 1.22
go 1.23
-- main.go --
package main
+1 -1
View File
@@ -42,7 +42,7 @@ cmp stdout main.stdout
-- go.mod --
module test/main
go 1.22
go 1.23
require (
gopkg.in/garbletest.v2 v2.999.0
+1 -1
View File
@@ -12,7 +12,7 @@ cmp stderr main.stderr
-- go.mod --
module test/main
go 1.22
go 1.23
-- main.go --
package main
+1 -1
View File
@@ -28,7 +28,7 @@ binsubstr main$exe 'unexportedVersion' 'ExportedUnset' 'v1.22.33' 'garble_replac
-- go.mod --
module domain.test/main
go 1.22
go 1.23
-- main.go --
package main
+1 -1
View File
@@ -40,7 +40,7 @@ cmp stderr main.stderr
-- go.mod --
module test/main
go 1.22
go 1.23
-- main.go --
package main
+2 -2
View File
@@ -14,7 +14,7 @@ cmp stderr main.stderr
-- go.mod --
module test/main
go 1.22
go 1.23
replace big.chungus/meme => ./big.chungus/meme
require big.chungus/meme v0.0.0
@@ -172,7 +172,7 @@ func ByteIndex(s string, c byte) int
-- big.chungus/meme/go.mod --
module test/main
go 1.22
go 1.23
-- big.chungus/meme/dante.go --
package meme
+1 -1
View File
@@ -8,7 +8,7 @@ imports_missing${/}imports.go:5:8: package test/main/missing is not in std (${GO
-- go.mod --
module test/main
go 1.22
go 1.23
-- broken/broken.go --
package broken
+1 -1
View File
@@ -59,7 +59,7 @@ exec garble -literals build std
-- go.mod --
module test/main
go 1.22
go 1.23
-- main.go --
package main
+1 -1
View File
@@ -26,7 +26,7 @@ stdout 'build\s*vcs.revision='${HEAD_COMMIT_SHA}
-- go.mod --
module test/main
go 1.22
go 1.23
-- main.go --
package main
+1 -1
View File
@@ -26,7 +26,7 @@ cmp stderr main.stderr
-- go.mod --
module test/main
go 1.22
go 1.23
-- plugin/main.go --
package main
+1 -1
View File
@@ -16,7 +16,7 @@ stdout 'varPositions is sorted'
-- go.mod --
module test/main
go 1.22
go 1.23
-- garble_main.go --
package main
+1 -1
View File
@@ -14,7 +14,7 @@ cmp stdout main.stdout
-- go.mod --
module test/main
go 1.22
go 1.23
-- garble_main.go --
package main
+1 -1
View File
@@ -46,7 +46,7 @@ cmp stdout main-literals.stderr
-- go.mod --
module test/main
go 1.22
go 1.23
-- long_main.go --
package main
+1 -1
View File
@@ -14,7 +14,7 @@ stdout 'garble_main\.go 9$'
-- go.mod --
module test/main
go 1.22
go 1.23
-- garble_main.go --
package main
+2 -2
View File
@@ -32,7 +32,7 @@ cd ..
-- mod1/go.mod --
module test/main/mod1
go 1.22
go 1.23
require gopkg.in/garbletest.v2 v2.999.0
@@ -52,7 +52,7 @@ func main() { garbletest.Test() }
-- mod2/go.mod --
module test/main/mod2
go 1.22
go 1.23
require gopkg.in/garbletest.v2 v2.999.0
+1 -1
View File
@@ -97,7 +97,7 @@ cmp stderr importedpkg.stderr
-- go.mod --
module test/main
go 1.22
go 1.23
-- main.go --
package main
+2 -2
View File
@@ -16,7 +16,7 @@ binsubstr main$exe 'globalVar' # 'globalType' matches on some, but not all, plat
-- extra/go.mod --
module private.source/extra
go 1.22
go 1.23
-- extra/extra.go --
package extra
@@ -26,7 +26,7 @@ func Func() string {
-- go.mod --
module test/main
go 1.22
go 1.23
// We include an extra module to obfuscate, included in the same original source
// code via a replace directive.
+1 -1
View File
@@ -52,7 +52,7 @@ stdout 'package bar_test, func name: test/bar\.OriginalFuncName'
-- go.mod --
module test/bar
go 1.22
go 1.23
-- bar.go --
package bar
+1 -1
View File
@@ -27,7 +27,7 @@ stderr 'funcStructExported false funcStructUnexported false'
-- go.mod --
module test/main
go 1.22
go 1.23
-- garble_main.go --
package main
+1 -1
View File
@@ -3,7 +3,7 @@ exec garble build
-- go.mod --
module test/main
go 1.22
go 1.23
-- garble_main.go --
package main