Skip to content

Require Go 1.20, test on 1.25/1.26/1.27 - #216

Merged
justinhwang merged 1 commit into
masterfrom
bump-go-1.25
Sep 21, 2026
Merged

justinhwang merged 1 commit into
masterfrom
bump-go-1.25

Conversation

@justinhwang

@justinhwang justinhwang commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Motivation

The CI matrix was 1.17.x / 1.18.x / 1.19.x, all long out of upstream support, and the pinned lint tooling no longer builds on any current toolchain:

golang.org/x/tools@v0.12.1/internal/tokeninternal.go:78:9:
  invalid array length -delta * delta (constant -256 of type int64)
make: *** [bin/golint] Error 1

Both golint and staticcheck fail to compile on this, so the Lint step is unfixable without moving the tooling forward. This is also what blocks #203: Dependabot rewrote tools/go.mod to go 1.26.0 (staticcheck 0.8.1's own floor), and Go 1.19 predates the three-component go directive, so it cannot even parse the file — invalid go version '1.26.0': must match format 1.23.

The aged-out CI matrix and the library's own minimum Go version are separate concerns, so this PR moves CI all the way forward but raises go.mod only as far as the source actually requires.

Changes

  • .github/workflows/go.yml: matrix → 1.25.x / 1.26.x / 1.27.x, with latest: true (and therefore lint) on 1.27.x.
  • go.mod: minimum Go version 1.181.20. This is the lowest floor the code permits: Pointer[T] wraps sync/atomic.Pointer[T], which landed in 1.19, and the pre-1.19 fallback is deleted below. Neither dependency constrains it further — testify v1.12.1 declares go 1.17, go.yaml.in/yaml/v3 v3.0.5 declares go 1.16.
  • tools/go.mod, tools/go.sum: honnef.co/go/tools v0.4.7v0.8.1, pulling a current x/tools. This matches Bump honnef.co/go/tools from 0.4.7 to 0.8.1 in /tools #203's dependency set exactly, so Bump honnef.co/go/tools from 0.4.7 to 0.8.1 in /tools #203 can be closed once this lands. staticcheck v0.8.1 declares go 1.26.0, so the tools module sits well ahead of the library — it is build-only tooling and does not affect consumers.
  • Pointer build variants: with a 1.20 floor the go1.18 && !go1.19 constraint is unsatisfiable, so pointer_go118_pre119.go is deleted, and the now-vacuous go1.18 / go1.19 tags are dropped from pointer_go118.go, pointer_go119.go and pointer_test.go. No build tags remain in the package. The surviving Pointer[T] is the sync/atomic.Pointer[T] implementation every supported toolchain already selected, so this is a pure deletion with no behavior change.

Breaking change

Raising the minimum Go version from 1.18 to 1.20 is breaking for consumers on 1.18 or 1.19 and should be called out in the release notes. I have not added a CHANGELOG entry — there is no Unreleased section yet and I did not want to presume the release framing.

Caveat: declared floor is not a tested floor

CI builds 1.25–1.27 only, so 1.20 through 1.24 are a compatibility promise rather than a tested configuration. If you would rather have the floor covered, add 1.20.x to the matrix; if you would rather not carry that promise at all, raising go.mod to 1.25 to match CI is the other consistent option.

Test plan

Run on go1.26.4 with the go 1.20 directive in place:

  • go build ./... — clean
  • go vet ./... — clean
  • go test ./... and go test -race ./... — pass
  • make gofmt golint staticcheck — exit 0, no findings from staticcheck 2026.2.1

🤖 Generated with Claude Code

@codecov

codecov Bot commented Sep 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (92fa5f6) to head (e4bcf90).

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #216   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           23        21    -2     
  Lines          410       397   -13     
=========================================
- Hits           410       397   -13     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rabbbit

rabbbit commented Sep 19, 2026

Copy link
Copy Markdown

Onboard with the testing matrix change, but is 1.25 in go mod actually required? Can we survive with some lower version?

@justinhwang justinhwang changed the title Require Go 1.25, test on 1.25/1.26/1.27 Require Go 1.20, test on 1.25/1.26/1.27 Sep 19, 2026
@justinhwang

Copy link
Copy Markdown
Contributor Author

Onboard with the testing matrix change, but is 1.25 in go mod actually required? Can we survive with some lower version?

Yeah 1.20 is fine, some of our other OSS projects note that we only support the two latest versions but not seeing that here

@justinhwang
justinhwang enabled auto-merge (squash) September 19, 2026 16:44
@justinhwang
justinhwang requested a review from rabbbit September 19, 2026 16:44
@rabbbit

rabbbit commented Sep 19, 2026

Copy link
Copy Markdown

Well supporting last 2 versions is fine if there's some feature we want to use - but if more previous versions arew fine then bumping the minimum unnecessarily is a bit mean.

Comment thread pointer.go

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we just delete this file?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or perhaps I'm struggling to understand? but it seems the file should either go or be merged?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yeah, I should've looked a little more carefully - these two _118 and _119 files can be merged together

The CI matrix (1.17/1.18/1.19) had aged out of upstream support, and the
pinned lint tooling no longer builds on any current toolchain:

    golang.org/x/tools@v0.12.1/internal/tokeninternal.go:78:9:
      invalid array length -delta * delta (constant -256 of type int64)

Move the matrix to 1.25/1.26/1.27, with lint running on 1.27. Raise the
module's minimum Go version only as far as the source actually requires:
Pointer[T] wraps sync/atomic.Pointer[T], which landed in 1.19, so 1.20 is
the floor. Neither dependency constrains this further -- testify v1.12.1
declares go 1.17 and go.yaml.in/yaml/v3 declares go 1.16.

Bump honnef.co/go/tools to v0.8.1 so staticcheck and golint compile
again. staticcheck v0.8.1 declares `go 1.26.0`, so the tools module sits
well ahead of the library; it is build-only and does not affect
consumers. This supersedes #203.

With a 1.20 floor, the pointer build variants are dead code: the
`go1.18 && !go1.19` constraint is unsatisfiable, so delete that file. The
surviving Pointer[T] is the sync/atomic.Pointer[T] implementation that
every supported toolchain already selected. With no build tags left, the
go118/go119 split is meaningless, so merge the two survivors into a single
pointer.go.

Note that CI does not build on 1.20-1.24, so the declared floor is a
compatibility promise rather than a tested configuration.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@justinhwang
justinhwang merged commit 2d2bdbd into master Sep 21, 2026
11 checks passed
@justinhwang
justinhwang deleted the bump-go-1.25 branch September 21, 2026 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants