Skip to content

Add prek hook to keep the Go toolchain version in sync#69338

Open
potiuk wants to merge 1 commit into
apache:mainfrom
potiuk:add-go-version-sync-hook
Open

Add prek hook to keep the Go toolchain version in sync#69338
potiuk wants to merge 1 commit into
apache:mainfrom
potiuk:add-go-version-sync-hook

Conversation

@potiuk

@potiuk potiuk commented Jul 3, 2026

Copy link
Copy Markdown
Member

Adds a prek hook, check-go-version-in-sync, that keeps the Go toolchain version consistent across every file that pins it, with go-sdk/go.mod as the single source of truth.

The Go version is pinned in eight places: go-sdk/go.mod, the go_example module, the setup-go step in both CI workflow copies, the golang:<ver>-alpine builder image used by the e2e conftest and by breeze, and default_language_version.golang in the top-level and go-sdk prek configs. They have no cross-file include, so a dependency bump that raises the go directive in go-sdk/go.mod leaves the rest behind — and the drift only surfaces as an opaque go.mod requires go >= <new> failure deep in CI, as happened in #69214. The hook fails fast and points at the exact drifting file, comparing at major.minor granularity.

Modelled on the existing check-java-sdk-version-in-sync hook.

related: #69214


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 4.8)

Generated-by: Claude Code (Opus 4.8) following the guidelines

The Go toolchain version is pinned in eight places (go-sdk/go.mod, the
go_example module, the setup-go step in both CI workflow copies, the
golang alpine builder image used by the e2e conftest and by breeze, and
the default_language_version.golang in the top-level and go-sdk prek
configs). They have no cross-file include, so a dependency bump that
raises the go directive in go-sdk/go.mod leaves the rest behind and the
drift only surfaces as an opaque "go.mod requires go >= <new>" failure
deep in CI — as happened in PR apache#69214.

Add a prek hook that treats go-sdk/go.mod as the single source of truth
and fails when any other site disagrees at major.minor granularity,
pointing directly at the drifting file.

@jason810496 jason810496 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice one!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants