From 58b2d64784a734edea8ad397576dec5731af050f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Sat, 1 Oct 2022 23:16:45 +0100 Subject: [PATCH] drop support for Go 1.18.x With Go 1.19 having been out for two months, and Go 1.20's first beta coming out in two months, it is now time to move forward again. --- .github/workflows/test.yml | 2 +- go.mod | 2 +- main.go | 4 ++-- testdata/script/asm.txtar | 3 +-- testdata/script/basic.txtar | 3 +-- testdata/script/cgo.txtar | 3 +-- testdata/script/crossbuild.txtar | 3 +-- testdata/script/debugdir.txtar | 3 +-- testdata/script/embed.txtar | 4 +--- testdata/script/goenv.txtar | 3 +-- testdata/script/gogarble.txtar | 3 +-- testdata/script/goversion.txtar | 29 ++++++++++++++--------------- testdata/script/help.txtar | 2 ++ testdata/script/implement.txtar | 3 +-- testdata/script/imports.txtar | 3 +-- testdata/script/init.txtar | 3 +-- testdata/script/ldflags.txtar | 3 +-- testdata/script/linkname.txtar | 11 +++-------- testdata/script/literals.txtar | 3 +-- testdata/script/modinfo.txtar | 3 +-- testdata/script/plugin.txtar | 3 +-- testdata/script/position.txtar | 3 +-- testdata/script/reflect.txtar | 3 +-- testdata/script/reverse.txtar | 3 +-- testdata/script/seed-cache.txtar | 5 ++--- testdata/script/seed.txtar | 3 +-- testdata/script/syntax.txtar | 5 ++--- testdata/script/test.txtar | 3 +-- testdata/script/tiny.txtar | 3 +-- testdata/script/typeparams.txtar | 4 +--- 30 files changed, 49 insertions(+), 79 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2101d8c..0600cc4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,7 +22,7 @@ jobs: test: strategy: matrix: - go-version: [1.18.x, 1.19.x] + go-version: [1.19.x] os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} steps: diff --git a/go.mod b/go.mod index 29078bf..4857de4 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module mvdan.cc/garble -go 1.18 +go 1.19 require ( github.com/frankban/quicktest v1.14.3 diff --git a/main.go b/main.go index a299826..4ae6323 100644 --- a/main.go +++ b/main.go @@ -253,8 +253,8 @@ var toolchainVersionSemver string func goVersionOK() bool { const ( - minGoVersionSemver = "v1.18.0" - suggestedGoVersion = "1.18.x" + minGoVersionSemver = "v1.19.0" + suggestedGoVersion = "1.19.x" ) // rxVersion looks for a version like "go1.2" or "go1.2.3" diff --git a/testdata/script/asm.txtar b/testdata/script/asm.txtar index 40e8e69..70b36c7 100644 --- a/testdata/script/asm.txtar +++ b/testdata/script/asm.txtar @@ -28,11 +28,10 @@ go build exec ./main cmp stderr main.stderr binsubstr main$exe 'privateAdd' 'PublicAdd' - -- go.mod -- module test/main -go 1.18 +go 1.19 -- main.go -- package main diff --git a/testdata/script/basic.txtar b/testdata/script/basic.txtar index 678e8d5..ae94531 100644 --- a/testdata/script/basic.txtar +++ b/testdata/script/basic.txtar @@ -56,11 +56,10 @@ cmp stderr main.stderr # Only check $WORK on non-windows, because it's difficult to do it there. binsubstr main$exe 'garble_main.go' 'globalVar' 'globalFunc' $gofullversion [!windows] binsubstr main$exe ${WORK} - -- go.mod -- module test/mainfoo -go 1.18 +go 1.19 -- garble_main.go -- package main diff --git a/testdata/script/cgo.txtar b/testdata/script/cgo.txtar index 0f48b23..570ae74 100644 --- a/testdata/script/cgo.txtar +++ b/testdata/script/cgo.txtar @@ -34,11 +34,10 @@ go build exec ./main cmp stdout main.stdout binsubstr main$exe 'privateAdd' - -- go.mod -- module test/main -go 1.18 +go 1.19 -- main.go -- package main diff --git a/testdata/script/crossbuild.txtar b/testdata/script/crossbuild.txtar index 27165cd..ff8b242 100644 --- a/testdata/script/crossbuild.txtar +++ b/testdata/script/crossbuild.txtar @@ -11,11 +11,10 @@ # A fairly average Go build, importing some std libraries. env GOGARBLE='*' garble build - -- go.mod -- module test/main -go 1.18 +go 1.19 -- main.go -- package main diff --git a/testdata/script/debugdir.txtar b/testdata/script/debugdir.txtar index 464178b..c29b752 100644 --- a/testdata/script/debugdir.txtar +++ b/testdata/script/debugdir.txtar @@ -14,11 +14,10 @@ cp $WORK/debug1/test/main/main.go $WORK/debug1/some_file_from_prev_build.go garble -debugdir ./debug1 build -v stderr 'test/main' # we force rebuilds with -debugdir ! exists $WORK/debug1/some_file_from_prev_build.go - -- go.mod -- module test/main -go 1.18 +go 1.19 -- main.go -- package main diff --git a/testdata/script/embed.txtar b/testdata/script/embed.txtar index 962b4f5..c8f9052 100644 --- a/testdata/script/embed.txtar +++ b/testdata/script/embed.txtar @@ -10,12 +10,10 @@ cmp stdout main.stdout go build exec ./main cmp stdout main.stdout - -- go.mod -- module test/main -go 1.18 - +go 1.19 -- main.go -- package main diff --git a/testdata/script/goenv.txtar b/testdata/script/goenv.txtar index 19469c4..82ab164 100644 --- a/testdata/script/goenv.txtar +++ b/testdata/script/goenv.txtar @@ -43,11 +43,10 @@ exec $NAME/garble$exe build [!windows] sleep $CP_EXEC_SLEEP [!windows] ! exec $NAME/garble$exe build [!windows] stderr 'cannot be quoted' - -- go.mod -- module test/main -go 1.18 +go 1.19 -- main.go -- package main diff --git a/testdata/script/gogarble.txtar b/testdata/script/gogarble.txtar index 1ab96ab..640c18f 100644 --- a/testdata/script/gogarble.txtar +++ b/testdata/script/gogarble.txtar @@ -46,11 +46,10 @@ env GOCACHE=${WORK}/gocache-empty garble build -a runtime garble build -o=out_rebuild ./stdimporter bincmp out_rebuild out - -- go.mod -- module test/main -go 1.18 +go 1.19 -- standalone/main.go -- package main diff --git a/testdata/script/goversion.txtar b/testdata/script/goversion.txtar index 0fe5ac1..e50a72b 100644 --- a/testdata/script/goversion.txtar +++ b/testdata/script/goversion.txtar @@ -7,30 +7,30 @@ env PATH=${WORK}/.bin${:}${PATH} # An empty go version. env TOOLCHAIN_GOVERSION='' ! garble build -stderr 'Go version is too old; please upgrade to Go 1\.18\.x or newer' +stderr 'Go version is too old; please upgrade to Go 1\.19\.x 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' ! garble build -stderr 'Go version is too old; please upgrade to Go 1\.18\.x or newer' +stderr 'Go version is too old; please upgrade to Go 1\.19\.x 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' ! garble build -stderr 'Go version "devel go1\.15-.*2020.*" is too old; please upgrade to Go 1\.18\.x' +stderr 'Go version "devel go1\.15-.*2020.*" is too old; please upgrade to Go 1\.19\.x' # A current devel version should be fine. # Note that we don't look at devel version timestamps. -env GARBLE_TEST_GOVERSION='go1.18' -env TOOLCHAIN_GOVERSION='devel go1.18-ad97d204f0 Sun Sep 12 16:46:58 2021 +0000' +env GARBLE_TEST_GOVERSION='go1.20' +env TOOLCHAIN_GOVERSION='devel go1.20-ad97d204f0 Sun Sep 12 16:46:58 2021 +0000' ! garble build stderr 'mocking the real build' # We should error on a stable version that's too old. env TOOLCHAIN_GOVERSION='go1.14' ! garble build -stderr 'Go version "go1\.14" is too old; please upgrade to Go 1\.18\.x or newer' +stderr 'Go version "go1\.14" is too old; please upgrade to Go 1\.19\.x or newer' # We should accept a future stable version. # Note that we need to bump the version of Go that supposedly built it, too. @@ -40,13 +40,13 @@ env TOOLCHAIN_GOVERSION='go1.28.2' stderr 'mocking the real build' # We should accept custom devel strings. -env TOOLCHAIN_GOVERSION='devel go1.18-somecustomversion' +env TOOLCHAIN_GOVERSION='devel go1.20-somecustomversion' ! garble build stderr 'mocking the real build' # The current toolchain may be older than the one that built garble. -env GARBLE_TEST_GOVERSION='go1.19' -env TOOLCHAIN_GOVERSION='go1.18.3' +env GARBLE_TEST_GOVERSION='go1.20' +env TOOLCHAIN_GOVERSION='go1.19.3' ! garble build stderr 'mocking the real build' @@ -64,22 +64,21 @@ stderr 'garble was built with "go1\.18" and is being used with "go1\.19\.1"; ple # 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.18.11' -env TOOLCHAIN_GOVERSION='go1.18.14' +env GARBLE_TEST_GOVERSION='go1.19.11' +env TOOLCHAIN_GOVERSION='go1.19.14' ! garble build -stderr 'garble was built with "go1\.18\.11" and is being used with "go1\.18\.14"; please rebuild garble with the newer version' +stderr 'garble was built with "go1\.19\.11" and is being used with "go1\.19\.14"; please rebuild garble with the newer version' # 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.18.3' +env TOOLCHAIN_GOVERSION='go1.19.3' ! garble build stderr 'mocking the real build' - -- go.mod -- module test/main -go 1.18 +go 1.19 -- main.go -- package main diff --git a/testdata/script/help.txtar b/testdata/script/help.txtar index b9b830a..c0c7ac3 100644 --- a/testdata/script/help.txtar +++ b/testdata/script/help.txtar @@ -118,5 +118,7 @@ stderr 'usage: garble version' # We need a dummy module for "garble build -badflag". -- go.mod -- module dummy + +go 1.19 -- dummy.go -- package dummy diff --git a/testdata/script/implement.txtar b/testdata/script/implement.txtar index bc99902..3dff9e5 100644 --- a/testdata/script/implement.txtar +++ b/testdata/script/implement.txtar @@ -12,11 +12,10 @@ cmp stdout main.stdout go build exec ./main cmp stdout main.stdout - -- go.mod -- module test/main -go 1.18 +go 1.19 -- main.go -- package main diff --git a/testdata/script/imports.txtar b/testdata/script/imports.txtar index 3f9d382..5659e0a 100644 --- a/testdata/script/imports.txtar +++ b/testdata/script/imports.txtar @@ -41,11 +41,10 @@ cmp stdout main.stdout garble -literals build --tags=buildtag exec ./main cmp stdout main.stdout - -- go.mod -- module test/main -go 1.18 +go 1.19 require ( gopkg.in/garbletest.v2 v2.999.0 diff --git a/testdata/script/init.txtar b/testdata/script/init.txtar index 0e7eda9..bcfc334 100644 --- a/testdata/script/init.txtar +++ b/testdata/script/init.txtar @@ -9,11 +9,10 @@ cmp stderr main.stderr go build exec ./main cmp stderr main.stderr - -- go.mod -- module test/main -go 1.18 +go 1.19 -- main.go -- package main diff --git a/testdata/script/ldflags.txtar b/testdata/script/ldflags.txtar index 79406cc..c41e795 100644 --- a/testdata/script/ldflags.txtar +++ b/testdata/script/ldflags.txtar @@ -27,11 +27,10 @@ go build -ldflags=${LDFLAGS} exec ./main cmp stdout main.stdout binsubstr main$exe 'unexportedVersion' 'ExportedUnset' 'v1.22.33' 'garble_replaced' - -- go.mod -- module domain.test/main -go 1.18 +go 1.19 -- main.go -- package main diff --git a/testdata/script/linkname.txtar b/testdata/script/linkname.txtar index cf5ec23..410934c 100644 --- a/testdata/script/linkname.txtar +++ b/testdata/script/linkname.txtar @@ -11,18 +11,14 @@ cmp stderr main.stderr go build exec ./main cmp stderr main.stderr - -- go.mod -- module test/main -go 1.18 +go 1.19 replace big.chungus/meme => ./big.chungus/meme -require ( - big.chungus/meme v0.0.0 -) - +require big.chungus/meme v0.0.0 -- a.go -- package main @@ -99,8 +95,7 @@ func ByteIndex(s string, c byte) int -- big.chungus/meme/go.mod -- module test/main -go 1.18 - +go 1.19 -- big.chungus/meme/dante.go -- package meme diff --git a/testdata/script/literals.txtar b/testdata/script/literals.txtar index 7902d32..757692c 100644 --- a/testdata/script/literals.txtar +++ b/testdata/script/literals.txtar @@ -54,11 +54,10 @@ grep '^\s+\w+ = .*\bappend\(\w+,(\s+\w+\[\d+\][\^\-+]\w+\[\d+\],?)+\)$' debug1/t # Analogous to gogarble.txt. env GOGARBLE='*' garble -literals build std - -- go.mod -- module test/main -go 1.18 +go 1.19 -- main.go -- package main diff --git a/testdata/script/modinfo.txtar b/testdata/script/modinfo.txtar index 70c5fc7..a947ad8 100644 --- a/testdata/script/modinfo.txtar +++ b/testdata/script/modinfo.txtar @@ -25,11 +25,10 @@ stdout 'path\s*test/main' stdout 'mod\s*test/main\s*\(devel\)' stdout 'build\s*-tags=veryuniquebuildtag' stdout 'build\s*vcs.revision='${HEAD_COMMIT_SHA} - -- go.mod -- module test/main -go 1.18 +go 1.19 -- main.go -- package main diff --git a/testdata/script/plugin.txtar b/testdata/script/plugin.txtar index 567c294..0fbdc4b 100644 --- a/testdata/script/plugin.txtar +++ b/testdata/script/plugin.txtar @@ -25,11 +25,10 @@ binsubstr plugin.so 'PublicVar' 'PublicFunc' 'privateFunc' go build exec ./main cmp stderr main.stderr - -- go.mod -- module test/main -go 1.18 +go 1.19 -- plugin/main.go -- package main diff --git a/testdata/script/position.txtar b/testdata/script/position.txtar index 2a5ff34..2e4bb5f 100644 --- a/testdata/script/position.txtar +++ b/testdata/script/position.txtar @@ -15,11 +15,10 @@ stdout 'garble_other_filename' stdout ':19: main' stdout 'initPositions is sorted' stdout 'varPositions is sorted' - -- go.mod -- module test/main -go 1.18 +go 1.19 -- garble_main.go -- package main diff --git a/testdata/script/reflect.txtar b/testdata/script/reflect.txtar index adac6f6..4f838b5 100644 --- a/testdata/script/reflect.txtar +++ b/testdata/script/reflect.txtar @@ -13,11 +13,10 @@ binsubstr main$exe 'ReflectInDefined' 'ExportedField2' 'unexportedField2' 'Indir go build exec ./main cmp stdout main.stdout - -- go.mod -- module test/main -go 1.18 +go 1.19 -- garble_main.go -- package main diff --git a/testdata/script/reverse.txtar b/testdata/script/reverse.txtar index 9d296d1..fdbca36 100644 --- a/testdata/script/reverse.txtar +++ b/testdata/script/reverse.txtar @@ -52,11 +52,10 @@ cmp stdout reverse.stdout stdin main-literals.stderr ! garble reverse . cmp stdout main-literals.stderr - -- go.mod -- module test/main -go 1.18 +go 1.19 -- long_main.go -- package main diff --git a/testdata/script/seed-cache.txtar b/testdata/script/seed-cache.txtar index 78c4880..99e2300 100644 --- a/testdata/script/seed-cache.txtar +++ b/testdata/script/seed-cache.txtar @@ -30,11 +30,10 @@ cp stdout ../buildid-mod2 cd .. ! bincmp buildid-mod1 buildid-mod2 - -- mod1/go.mod -- module test/main/mod1 -go 1.18 +go 1.19 require gopkg.in/garbletest.v2 v2.999.0 @@ -54,7 +53,7 @@ func main() { garbletest.Test() } -- mod2/go.mod -- module test/main/mod2 -go 1.18 +go 1.19 require gopkg.in/garbletest.v2 v2.999.0 diff --git a/testdata/script/seed.txtar b/testdata/script/seed.txtar index d3364f0..02b10ab 100644 --- a/testdata/script/seed.txtar +++ b/testdata/script/seed.txtar @@ -95,11 +95,10 @@ exec ./main$exe test/main cmp stderr mainpkg.stderr exec ./main$exe test/main/imported cmp stderr importedpkg.stderr - -- go.mod -- module test/main -go 1.18 +go 1.19 -- main.go -- package main diff --git a/testdata/script/syntax.txtar b/testdata/script/syntax.txtar index 6c7cc14..7cb297b 100644 --- a/testdata/script/syntax.txtar +++ b/testdata/script/syntax.txtar @@ -15,11 +15,10 @@ cmp stderr main.stderr binsubstr main$exe 'globalVar' # 'globalType' matches on some, but not all, platforms ! binsubstr main$exe 'localName' 'globalConst' 'remoteIntReturn' 'intReturn' - -- extra/go.mod -- module private.source/extra -go 1.18 +go 1.19 -- extra/extra.go -- package extra @@ -29,7 +28,7 @@ func Func() string { -- go.mod -- module test/main -go 1.18 +go 1.19 // We include an extra module to obfuscate, included in the same original source // code via a replace directive. diff --git a/testdata/script/test.txtar b/testdata/script/test.txtar index ea87019..f192bea 100644 --- a/testdata/script/test.txtar +++ b/testdata/script/test.txtar @@ -47,11 +47,10 @@ stdout 'PASS.*TestFoo' stdout 'PASS.*TestSeparateFoo' stdout 'package bar, func name: test/bar\.OriginalFuncName' stdout 'package bar_test, func name: test/bar\.OriginalFuncName' - -- go.mod -- module test/bar -go 1.18 +go 1.19 -- bar.go -- package bar diff --git a/testdata/script/tiny.txtar b/testdata/script/tiny.txtar index 07568d9..5eb3eaf 100644 --- a/testdata/script/tiny.txtar +++ b/testdata/script/tiny.txtar @@ -23,11 +23,10 @@ garble build stderr '^caller: [0-9a-zA-Z_]+\.go [1-9]' stderr '^recovered: ya like jazz?' stderr 'panic: oh noes' - -- go.mod -- module test/main -go 1.18 +go 1.19 -- garble_main.go -- package main diff --git a/testdata/script/typeparams.txtar b/testdata/script/typeparams.txtar index f2f9898..02dd341 100644 --- a/testdata/script/typeparams.txtar +++ b/testdata/script/typeparams.txtar @@ -2,12 +2,10 @@ env GOGARBLE=* garble build ! binsubstr main$exe ${WORK} 'garble_main.go' 'GenericFunc' 'GenericVector' 'PredeclaredSignedInteger' 'StringableSignedInteger' 'CombineEmbeds' 'GenericParam' - -- go.mod -- module test/main -go 1.18 - +go 1.19 -- garble_main.go -- package main