Skip to content

Commit

Permalink
all: start suggesting Go 1.21 and testing on it
Browse files Browse the repository at this point in the history
Also note that the first release is now 1.21.0,
so we no longer need to use the awkward 1.21.x notation in warnings.
  • Loading branch information
mvdan committed Sep 23, 2023
1 parent 23c8641 commit 4150e35
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
test:
strategy:
matrix:
go-version: [1.20.x]
go-version: [1.20.x, 1.21.x]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -53,17 +53,17 @@ jobs:
# Static checks from this point forward. Only run on one Go version and on
# linux, since it's the fastest platform, and the tools behave the same.
- name: Test third-party project builds
if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.20.x'
if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.21.x'
run: |
go install
./scripts/check-third-party.sh
- if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.20.x'
- if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.21.x'
run: ./scripts/crlf-test.sh
- if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.20.x'
- if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.21.x'
run: diff <(echo -n) <(gofmt -d .)
- if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.20.x'
- if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.21.x'
run: go vet ./...
- if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.20.x'
- if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.21.x'
uses: dominikh/staticcheck-action@v1
with:
version: "2023.1.3"
Expand All @@ -81,11 +81,12 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: 1.20.x
go-version: 1.21.x
cache: false
- run: go test -short ./...

test-gotip:
if: false # let tip for 1.22 settle first
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ func (e errJustExit) Error() string { return fmt.Sprintf("exit: %d", e) }
func goVersionOK() bool {
const (
minGoVersionSemver = "v1.20.0"
suggestedGoVersion = "1.20.x"
suggestedGoVersion = "1.21"
)

// rxVersion looks for a version like "go1.2" or "go1.2.3"
Expand Down
12 changes: 6 additions & 6 deletions testdata/script/goversion.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -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 Go 1\.20\.x or newer'
stderr 'Go version is too old; please upgrade to Go 1\.21 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 Go 1\.20\.x or newer'
stderr 'Go version is too old; please upgrade to Go 1\.21 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 Go 1\.20\.x'
stderr 'Go version "devel go1\.15-.*2020.*" is too old; please upgrade to Go 1\.21'

# A current devel version should be fine.
# Note that we don't look at devel version timestamps.
env GARBLE_TEST_GOVERSION='go1.20'
env TOOLCHAIN_GOVERSION='devel go1.20-ad97d204f0 Sun Sep 12 16:46:58 2023 +0000'
env GARBLE_TEST_GOVERSION='go1.21'
env TOOLCHAIN_GOVERSION='devel go1.21-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 Go 1\.20\.x or newer'
stderr 'Go version "go1\.14" is too old; please upgrade to Go 1\.21 or newer'

# We should accept a future stable version.
# Note that we need to bump the version of Go that supposedly built it, too.
Expand Down

0 comments on commit 4150e35

Please sign in to comment.