Skip to content

Support Go 1.27 by upgrading golang.org/x/tools to v0.48.0 - #312

Merged
sywhang merged 1 commit into
uber-go:mainfrom
moisesvega:go127-x-tools-upgrade
Aug 9, 2026
Merged

Support Go 1.27 by upgrading golang.org/x/tools to v0.48.0#312
sywhang merged 1 commit into
uber-go:mainfrom
moisesvega:go127-x-tools-upgrade

Conversation

@moisesvega

@moisesvega moisesvega commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

Why

Go 1.27's compiler emits export data version 4, which the pinned golang.org/x/tools v0.36.0 cannot decode. mockgen's package mode imports type information through x/tools, so generating mocks on Go 1.27 (currently rc2) fails with:

internal error in importing "..." (cannot decode "...", export data version 4 is greater than maximum supported version 2); please report an issue

What

  • Upgrade golang.org/x/tools v0.36.0 → v0.48.0 (with x/mod v0.38.0, x/sync v0.22.0).
  • Bump the module's minimum Go version 1.23 → 1.25. This is unavoidable: I bisected x/tools releases and v0.44.0 is the first that decodes the new export-data format, and it already requires Go 1.25 — there is no upgrade path that keeps 1.24 support.
  • Re-tidy the generics and typed test sub-modules, which replace the main module.
  • CI: test matrix [1.24.x, 1.25.x][1.25.x, 1.26.x, 1.27.0-rc.2] (1.24.x can no longer build the module; the rc entry guards against future export-data bumps); release workflow 1.23.x → 1.25.x.

The bazel module is unaffected — it pins the published go.uber.org/mock v0.6.0 with its own SDK, so it picks up Go 1.27 support with the next release.

Test Plan

Full test suite passes on both go1.27rc2 and go1.26.4 (all packages, including the tools, generics, and typed sub-modules), go vet ./... is clean, and both ci/test.sh and ci/check_panic_handling.sh pass locally with go1.27rc2.

Go 1.27's compiler emits export data version 4, which x/tools v0.36.0
cannot decode. mockgen's package mode imports type information through
x/tools, so generating mocks on Go 1.27 failed with "export data
version 4 is greater than maximum supported version 2".

x/tools v0.44.0 is the first release that decodes the new format and
it requires Go 1.25, so the module's minimum Go version moves from
1.23 to 1.25 — there is no upgrade path that keeps 1.24 support. The
generics and typed test sub-modules are re-tidied to match, the CI
test matrix drops 1.24.x in favor of 1.25.x/1.26.x plus 1.27.0-rc.2
to guard against future export-data bumps, and the release workflow
moves off the no-longer-buildable 1.23.x.
@sywhang
sywhang merged commit c084ae9 into uber-go:main Aug 9, 2026
6 checks passed
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.

3 participants