From 8ad374d2fb1f94e9376522568c15d65991452e5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Sat, 3 Sep 2022 17:13:56 +0100 Subject: [PATCH] start testing on Go 1.19.x While here, start the changelog for the upcoming release, which will likely be a bugfix release as it's a bit early to drop 1.18. We also bump staticcheck to get a version that supports 1.19. I also noticed the "Go version X or newer" messages were slightly weird and inconsistent. Our policy, per the README, is "Go version X or newer", so the errors given to the user were unnecessarily confusing. For example, now that Go 1.19 is out, we shouldn't simply recommend that they upgrade to 1.18; we should recommend 1.18 or later. --- .github/workflows/test.yml | 16 ++++++++-------- CHANGELOG.md | 8 ++++++++ main.go | 4 ++-- testdata/scripts/goversion.txt | 7 +++---- 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 19cda3d..e4d4c12 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,7 +22,7 @@ jobs: test: strategy: matrix: - go-version: [1.18.x] + go-version: [1.18.x, 1.19.x] os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} steps: @@ -41,20 +41,20 @@ 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.18.x' + if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.19.x' run: | go install ./scripts/check-third-party.sh - - if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.18.x' + - if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.19.x' run: ./scripts/crlf-test.sh - - if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.18.x' + - if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.19.x' run: diff <(echo -n) <(gofmt -d .) - - if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.18.x' + - if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.19.x' run: go vet ./... - - if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.18.x' + - if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.19.x' uses: dominikh/staticcheck-action@v1 with: - version: "2022.1.1" + version: "2022.1.3" install-go: false # We don't care about GOARCH=386 particularly, @@ -68,7 +68,7 @@ jobs: steps: - uses: actions/setup-go@v3 with: - go-version: 1.18.x + go-version: 1.19.x - uses: actions/checkout@v3 - name: Test run: go test -timeout=15m ./... diff --git a/CHANGELOG.md b/CHANGELOG.md index ae963d8..c5ec030 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## [v0.7.2] - 2022-09-?? + +This bugfix release continues support for Go 1.18 and 1.19. + +* Fix an edge case resulting in bad syntax due to comments - [#573] + ## [v0.7.1] - 2022-08-02 This bugfix release finishes support for Go 1.19 and features: @@ -137,6 +143,8 @@ Known bugs: * obfuscating the standard library with `GOPRIVATE=*` is not well supported yet * `garble test` is temporarily disabled, as it is currently broken +[#573]: https://github.com/burrowers/garble/issues/573 + [v0.7.1]: https://github.com/burrowers/garble/releases/tag/v0.7.1 [v0.7.0]: https://github.com/burrowers/garble/releases/tag/v0.7.0 diff --git a/main.go b/main.go index aa6f16f..74f8b99 100644 --- a/main.go +++ b/main.go @@ -266,13 +266,13 @@ func goVersionOK() bool { // Go 1.15.x and older do not have GOVERSION yet. // We could go the extra mile and fetch it via 'go toolchainVersion', // but we'd have to error anyway. - fmt.Fprintf(os.Stderr, "Go version is too old; please upgrade to Go %s or a newer devel version\n", suggestedGoVersion) + fmt.Fprintf(os.Stderr, "Go version is too old; please upgrade to Go %s or newer\n", suggestedGoVersion) return false } toolchainVersionSemver = "v" + strings.TrimPrefix(toolchainVersion, "go") if semver.Compare(toolchainVersionSemver, minGoVersionSemver) < 0 { - fmt.Fprintf(os.Stderr, "Go version %q is too old; please upgrade to Go %s\n", toolchainVersionFull, suggestedGoVersion) + fmt.Fprintf(os.Stderr, "Go version %q is too old; please upgrade to Go %s or newer\n", toolchainVersionFull, suggestedGoVersion) return false } diff --git a/testdata/scripts/goversion.txt b/testdata/scripts/goversion.txt index 9f3b764..0fe5ac1 100644 --- a/testdata/scripts/goversion.txt +++ b/testdata/scripts/goversion.txt @@ -7,13 +7,13 @@ 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 a newer devel version' +stderr 'Go version is too old; please upgrade to Go 1\.18\.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 a newer devel version' +stderr 'Go version is too old; please upgrade to Go 1\.18\.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' @@ -30,8 +30,7 @@ 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' -! stderr 'or a newer devel version' +stderr 'Go version "go1\.14" is too old; please upgrade to Go 1\.18\.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.