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.
pull/591/head
Daniel Martí 2 years ago
parent 5d926a8011
commit 58b2d64784

@ -22,7 +22,7 @@ jobs:
test: test:
strategy: strategy:
matrix: matrix:
go-version: [1.18.x, 1.19.x] go-version: [1.19.x]
os: [ubuntu-latest, macos-latest, windows-latest] os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:

@ -1,6 +1,6 @@
module mvdan.cc/garble module mvdan.cc/garble
go 1.18 go 1.19
require ( require (
github.com/frankban/quicktest v1.14.3 github.com/frankban/quicktest v1.14.3

@ -253,8 +253,8 @@ var toolchainVersionSemver string
func goVersionOK() bool { func goVersionOK() bool {
const ( const (
minGoVersionSemver = "v1.18.0" minGoVersionSemver = "v1.19.0"
suggestedGoVersion = "1.18.x" suggestedGoVersion = "1.19.x"
) )
// rxVersion looks for a version like "go1.2" or "go1.2.3" // rxVersion looks for a version like "go1.2" or "go1.2.3"

@ -28,11 +28,10 @@ go build
exec ./main exec ./main
cmp stderr main.stderr cmp stderr main.stderr
binsubstr main$exe 'privateAdd' 'PublicAdd' binsubstr main$exe 'privateAdd' 'PublicAdd'
-- go.mod -- -- go.mod --
module test/main module test/main
go 1.18 go 1.19
-- main.go -- -- main.go --
package main package main

@ -56,11 +56,10 @@ cmp stderr main.stderr
# Only check $WORK on non-windows, because it's difficult to do it there. # Only check $WORK on non-windows, because it's difficult to do it there.
binsubstr main$exe 'garble_main.go' 'globalVar' 'globalFunc' $gofullversion binsubstr main$exe 'garble_main.go' 'globalVar' 'globalFunc' $gofullversion
[!windows] binsubstr main$exe ${WORK} [!windows] binsubstr main$exe ${WORK}
-- go.mod -- -- go.mod --
module test/mainfoo module test/mainfoo
go 1.18 go 1.19
-- garble_main.go -- -- garble_main.go --
package main package main

@ -34,11 +34,10 @@ go build
exec ./main exec ./main
cmp stdout main.stdout cmp stdout main.stdout
binsubstr main$exe 'privateAdd' binsubstr main$exe 'privateAdd'
-- go.mod -- -- go.mod --
module test/main module test/main
go 1.18 go 1.19
-- main.go -- -- main.go --
package main package main

@ -11,11 +11,10 @@
# A fairly average Go build, importing some std libraries. # A fairly average Go build, importing some std libraries.
env GOGARBLE='*' env GOGARBLE='*'
garble build garble build
-- go.mod -- -- go.mod --
module test/main module test/main
go 1.18 go 1.19
-- main.go -- -- main.go --
package main package main

@ -14,11 +14,10 @@ cp $WORK/debug1/test/main/main.go $WORK/debug1/some_file_from_prev_build.go
garble -debugdir ./debug1 build -v garble -debugdir ./debug1 build -v
stderr 'test/main' # we force rebuilds with -debugdir stderr 'test/main' # we force rebuilds with -debugdir
! exists $WORK/debug1/some_file_from_prev_build.go ! exists $WORK/debug1/some_file_from_prev_build.go
-- go.mod -- -- go.mod --
module test/main module test/main
go 1.18 go 1.19
-- main.go -- -- main.go --
package main package main

@ -10,12 +10,10 @@ cmp stdout main.stdout
go build go build
exec ./main exec ./main
cmp stdout main.stdout cmp stdout main.stdout
-- go.mod -- -- go.mod --
module test/main module test/main
go 1.18 go 1.19
-- main.go -- -- main.go --
package main package main

@ -43,11 +43,10 @@ exec $NAME/garble$exe build
[!windows] sleep $CP_EXEC_SLEEP [!windows] sleep $CP_EXEC_SLEEP
[!windows] ! exec $NAME/garble$exe build [!windows] ! exec $NAME/garble$exe build
[!windows] stderr 'cannot be quoted' [!windows] stderr 'cannot be quoted'
-- go.mod -- -- go.mod --
module test/main module test/main
go 1.18 go 1.19
-- main.go -- -- main.go --
package main package main

@ -46,11 +46,10 @@ env GOCACHE=${WORK}/gocache-empty
garble build -a runtime garble build -a runtime
garble build -o=out_rebuild ./stdimporter garble build -o=out_rebuild ./stdimporter
bincmp out_rebuild out bincmp out_rebuild out
-- go.mod -- -- go.mod --
module test/main module test/main
go 1.18 go 1.19
-- standalone/main.go -- -- standalone/main.go --
package main package main

@ -7,30 +7,30 @@ env PATH=${WORK}/.bin${:}${PATH}
# An empty go version. # An empty go version.
env TOOLCHAIN_GOVERSION='' env TOOLCHAIN_GOVERSION=''
! garble build ! 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. # We should error on a devel version that's too old.
# Note that they lacked the "goN.M-" prefix. # Note that they lacked the "goN.M-" prefix.
env TOOLCHAIN_GOVERSION='devel +afb5fca Sun Aug 07 00:00:00 2020 +0000' env TOOLCHAIN_GOVERSION='devel +afb5fca Sun Aug 07 00:00:00 2020 +0000'
! garble build ! 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. # 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' env TOOLCHAIN_GOVERSION='devel go1.15-afb5fca Sun Aug 07 00:00:00 2020 +0000'
! garble build ! 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. # A current devel version should be fine.
# Note that we don't look at devel version timestamps. # Note that we don't look at devel version timestamps.
env GARBLE_TEST_GOVERSION='go1.18' env GARBLE_TEST_GOVERSION='go1.20'
env TOOLCHAIN_GOVERSION='devel go1.18-ad97d204f0 Sun Sep 12 16:46:58 2021 +0000' env TOOLCHAIN_GOVERSION='devel go1.20-ad97d204f0 Sun Sep 12 16:46:58 2021 +0000'
! garble build ! garble build
stderr 'mocking the real build' stderr 'mocking the real build'
# We should error on a stable version that's too old. # We should error on a stable version that's too old.
env TOOLCHAIN_GOVERSION='go1.14' env TOOLCHAIN_GOVERSION='go1.14'
! garble build ! 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. # We should accept a future stable version.
# Note that we need to bump the version of Go that supposedly built it, too. # 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' stderr 'mocking the real build'
# We should accept custom devel strings. # We should accept custom devel strings.
env TOOLCHAIN_GOVERSION='devel go1.18-somecustomversion' env TOOLCHAIN_GOVERSION='devel go1.20-somecustomversion'
! garble build ! garble build
stderr 'mocking the real build' stderr 'mocking the real build'
# The current toolchain may be older than the one that built garble. # The current toolchain may be older than the one that built garble.
env GARBLE_TEST_GOVERSION='go1.19' env GARBLE_TEST_GOVERSION='go1.20'
env TOOLCHAIN_GOVERSION='go1.18.3' env TOOLCHAIN_GOVERSION='go1.19.3'
! garble build ! garble build
stderr 'mocking the real 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. # 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. # 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 GARBLE_TEST_GOVERSION='go1.19.11'
env TOOLCHAIN_GOVERSION='go1.18.14' env TOOLCHAIN_GOVERSION='go1.19.14'
! garble build ! 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. # 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. # As a fallback, we drop the comparison against the toolchain's version.
env GARBLE_TEST_GOVERSION='bogus version' env GARBLE_TEST_GOVERSION='bogus version'
env TOOLCHAIN_GOVERSION='go1.18.3' env TOOLCHAIN_GOVERSION='go1.19.3'
! garble build ! garble build
stderr 'mocking the real build' stderr 'mocking the real build'
-- go.mod -- -- go.mod --
module test/main module test/main
go 1.18 go 1.19
-- main.go -- -- main.go --
package main package main

@ -118,5 +118,7 @@ stderr 'usage: garble version'
# We need a dummy module for "garble build -badflag". # We need a dummy module for "garble build -badflag".
-- go.mod -- -- go.mod --
module dummy module dummy
go 1.19
-- dummy.go -- -- dummy.go --
package dummy package dummy

@ -12,11 +12,10 @@ cmp stdout main.stdout
go build go build
exec ./main exec ./main
cmp stdout main.stdout cmp stdout main.stdout
-- go.mod -- -- go.mod --
module test/main module test/main
go 1.18 go 1.19
-- main.go -- -- main.go --
package main package main

@ -41,11 +41,10 @@ cmp stdout main.stdout
garble -literals build --tags=buildtag garble -literals build --tags=buildtag
exec ./main exec ./main
cmp stdout main.stdout cmp stdout main.stdout
-- go.mod -- -- go.mod --
module test/main module test/main
go 1.18 go 1.19
require ( require (
gopkg.in/garbletest.v2 v2.999.0 gopkg.in/garbletest.v2 v2.999.0

@ -9,11 +9,10 @@ cmp stderr main.stderr
go build go build
exec ./main exec ./main
cmp stderr main.stderr cmp stderr main.stderr
-- go.mod -- -- go.mod --
module test/main module test/main
go 1.18 go 1.19
-- main.go -- -- main.go --
package main package main

@ -27,11 +27,10 @@ go build -ldflags=${LDFLAGS}
exec ./main exec ./main
cmp stdout main.stdout cmp stdout main.stdout
binsubstr main$exe 'unexportedVersion' 'ExportedUnset' 'v1.22.33' 'garble_replaced' binsubstr main$exe 'unexportedVersion' 'ExportedUnset' 'v1.22.33' 'garble_replaced'
-- go.mod -- -- go.mod --
module domain.test/main module domain.test/main
go 1.18 go 1.19
-- main.go -- -- main.go --
package main package main

@ -11,18 +11,14 @@ cmp stderr main.stderr
go build go build
exec ./main exec ./main
cmp stderr main.stderr cmp stderr main.stderr
-- go.mod -- -- go.mod --
module test/main module test/main
go 1.18 go 1.19
replace big.chungus/meme => ./big.chungus/meme replace big.chungus/meme => ./big.chungus/meme
require ( require big.chungus/meme v0.0.0
big.chungus/meme v0.0.0
)
-- a.go -- -- a.go --
package main package main
@ -99,8 +95,7 @@ func ByteIndex(s string, c byte) int
-- big.chungus/meme/go.mod -- -- big.chungus/meme/go.mod --
module test/main module test/main
go 1.18 go 1.19
-- big.chungus/meme/dante.go -- -- big.chungus/meme/dante.go --
package meme package meme

@ -54,11 +54,10 @@ grep '^\s+\w+ = .*\bappend\(\w+,(\s+\w+\[\d+\][\^\-+]\w+\[\d+\],?)+\)$' debug1/t
# Analogous to gogarble.txt. # Analogous to gogarble.txt.
env GOGARBLE='*' env GOGARBLE='*'
garble -literals build std garble -literals build std
-- go.mod -- -- go.mod --
module test/main module test/main
go 1.18 go 1.19
-- main.go -- -- main.go --
package main package main

@ -25,11 +25,10 @@ stdout 'path\s*test/main'
stdout 'mod\s*test/main\s*\(devel\)' stdout 'mod\s*test/main\s*\(devel\)'
stdout 'build\s*-tags=veryuniquebuildtag' stdout 'build\s*-tags=veryuniquebuildtag'
stdout 'build\s*vcs.revision='${HEAD_COMMIT_SHA} stdout 'build\s*vcs.revision='${HEAD_COMMIT_SHA}
-- go.mod -- -- go.mod --
module test/main module test/main
go 1.18 go 1.19
-- main.go -- -- main.go --
package main package main

@ -25,11 +25,10 @@ binsubstr plugin.so 'PublicVar' 'PublicFunc' 'privateFunc'
go build go build
exec ./main exec ./main
cmp stderr main.stderr cmp stderr main.stderr
-- go.mod -- -- go.mod --
module test/main module test/main
go 1.18 go 1.19
-- plugin/main.go -- -- plugin/main.go --
package main package main

@ -15,11 +15,10 @@ stdout 'garble_other_filename'
stdout ':19: main' stdout ':19: main'
stdout 'initPositions is sorted' stdout 'initPositions is sorted'
stdout 'varPositions is sorted' stdout 'varPositions is sorted'
-- go.mod -- -- go.mod --
module test/main module test/main
go 1.18 go 1.19
-- garble_main.go -- -- garble_main.go --
package main package main

@ -13,11 +13,10 @@ binsubstr main$exe 'ReflectInDefined' 'ExportedField2' 'unexportedField2' 'Indir
go build go build
exec ./main exec ./main
cmp stdout main.stdout cmp stdout main.stdout
-- go.mod -- -- go.mod --
module test/main module test/main
go 1.18 go 1.19
-- garble_main.go -- -- garble_main.go --
package main package main

@ -52,11 +52,10 @@ cmp stdout reverse.stdout
stdin main-literals.stderr stdin main-literals.stderr
! garble reverse . ! garble reverse .
cmp stdout main-literals.stderr cmp stdout main-literals.stderr
-- go.mod -- -- go.mod --
module test/main module test/main
go 1.18 go 1.19
-- long_main.go -- -- long_main.go --
package main package main

@ -30,11 +30,10 @@ cp stdout ../buildid-mod2
cd .. cd ..
! bincmp buildid-mod1 buildid-mod2 ! bincmp buildid-mod1 buildid-mod2
-- mod1/go.mod -- -- mod1/go.mod --
module test/main/mod1 module test/main/mod1
go 1.18 go 1.19
require gopkg.in/garbletest.v2 v2.999.0 require gopkg.in/garbletest.v2 v2.999.0
@ -54,7 +53,7 @@ func main() { garbletest.Test() }
-- mod2/go.mod -- -- mod2/go.mod --
module test/main/mod2 module test/main/mod2
go 1.18 go 1.19
require gopkg.in/garbletest.v2 v2.999.0 require gopkg.in/garbletest.v2 v2.999.0

@ -95,11 +95,10 @@ exec ./main$exe test/main
cmp stderr mainpkg.stderr cmp stderr mainpkg.stderr
exec ./main$exe test/main/imported exec ./main$exe test/main/imported
cmp stderr importedpkg.stderr cmp stderr importedpkg.stderr
-- go.mod -- -- go.mod --
module test/main module test/main
go 1.18 go 1.19
-- main.go -- -- main.go --
package main package main

@ -15,11 +15,10 @@ cmp stderr main.stderr
binsubstr main$exe 'globalVar' # 'globalType' matches on some, but not all, platforms binsubstr main$exe 'globalVar' # 'globalType' matches on some, but not all, platforms
! binsubstr main$exe 'localName' 'globalConst' 'remoteIntReturn' 'intReturn' ! binsubstr main$exe 'localName' 'globalConst' 'remoteIntReturn' 'intReturn'
-- extra/go.mod -- -- extra/go.mod --
module private.source/extra module private.source/extra
go 1.18 go 1.19
-- extra/extra.go -- -- extra/extra.go --
package extra package extra
@ -29,7 +28,7 @@ func Func() string {
-- go.mod -- -- go.mod --
module test/main module test/main
go 1.18 go 1.19
// We include an extra module to obfuscate, included in the same original source // We include an extra module to obfuscate, included in the same original source
// code via a replace directive. // code via a replace directive.

@ -47,11 +47,10 @@ stdout 'PASS.*TestFoo'
stdout 'PASS.*TestSeparateFoo' stdout 'PASS.*TestSeparateFoo'
stdout 'package bar, func name: test/bar\.OriginalFuncName' stdout 'package bar, func name: test/bar\.OriginalFuncName'
stdout 'package bar_test, func name: test/bar\.OriginalFuncName' stdout 'package bar_test, func name: test/bar\.OriginalFuncName'
-- go.mod -- -- go.mod --
module test/bar module test/bar
go 1.18 go 1.19
-- bar.go -- -- bar.go --
package bar package bar

@ -23,11 +23,10 @@ garble build
stderr '^caller: [0-9a-zA-Z_]+\.go [1-9]' stderr '^caller: [0-9a-zA-Z_]+\.go [1-9]'
stderr '^recovered: ya like jazz?' stderr '^recovered: ya like jazz?'
stderr 'panic: oh noes' stderr 'panic: oh noes'
-- go.mod -- -- go.mod --
module test/main module test/main
go 1.18 go 1.19
-- garble_main.go -- -- garble_main.go --
package main package main

@ -2,12 +2,10 @@ env GOGARBLE=*
garble build garble build
! binsubstr main$exe ${WORK} 'garble_main.go' 'GenericFunc' 'GenericVector' 'PredeclaredSignedInteger' 'StringableSignedInteger' 'CombineEmbeds' 'GenericParam' ! binsubstr main$exe ${WORK} 'garble_main.go' 'GenericFunc' 'GenericVector' 'PredeclaredSignedInteger' 'StringableSignedInteger' 'CombineEmbeds' 'GenericParam'
-- go.mod -- -- go.mod --
module test/main module test/main
go 1.18 go 1.19
-- garble_main.go -- -- garble_main.go --
package main package main

Loading…
Cancel
Save