Repository navigation
build: lower go.mod directive to actual minimum required - #62
Merged
Merged
Conversation
…quires The go directive was pinned to 1.27.1 (latest stable) with no code-level justification. Determined via go build -gcflags="-lang=go1.2X" ./... that the code's own syntax/stdlib usage (generics, atomic.Pointer[T], errors.Join, math/rand/v2, and the per-iteration for-range loop variable semantics relied on in proxy.serve's goroutine closure) only needs 1.22. The actual binding floor is higher: golang.org/x/sync v0.23.0 (already pinned, providing singleflight) declares go 1.26.0 in its own go.mod, and go mod tidy raises the directive accordingly. go 1.25.0 fails go build with "updates to go.mod needed"; go 1.26.0 builds, vets, and passes go test -race cleanly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
go.mod'sgodirective from1.27.1(latest stable, pinned with no code justification) to1.26.0.toolchainline is added: CI/release already usego-version-file: go.mod(setup-go), so they'll simply build with 1.26.0 going forward — nothing in this repo needs a newer toolchain than the floor.How the minimum was determined
go build -gcflags="-lang=go1.2X" ./...at decreasing X:atomic.Pointer[T],token.go/proxy.go) → needs go1.18.errors.Join→ go1.20.math/rand/v2→ go1.22.proxy.serve'sgo func() { ... proxyConfig ... }()inside afor _, proxyConfig := range configsloop relies on Go's per-iteration loop-variable semantics (Go 1.22+) — with an oldergodirective this closure would silently capture the shared loop variable across goroutines, a real data-race/logic bug, not just a syntax check. This pushes the language floor to 1.22.-langonly checks syntax, not the module graph. Runninggo mod tidyafter settinggo 1.22auto-raised the directive to 1.26.0, becausegolang.org/x/sync v0.23.0(already pinned, used forsingleflight) declaresgo 1.26.0in its own go.mod — that's a stricter, binding floor imposed by an existing dependency pin, independent of anything in this repo's own code.go build ./...withgo 1.25.0fails (updates to go.mod needed; to update it: go mod tidy); withgo 1.26.0it builds cleanly.So the actual, tooling-verified minimum is go 1.26.0 — one minor version below the previous 1.27.1 pin, not 1.22 as the raw language-feature scan alone would suggest, because of the
x/syncdependency's own floor. Did not touch dependency versions (out of scope for this issue); happy to explore downgradingx/syncin a follow-up if a lower floor is wanted.Test plan
go mod tidy— no further changes beyond thegodirectivego build ./...go vet ./...go test -race ./...— all packages passgo 1.25.0fails to build (proves 1.26.0 is the true floor, not an arbitrary choice)