[TE-5843] Encode v2 major version in go.mod module path#510
Merged
Conversation
Go's major version suffix rules require modules at v2+ to encode the
major version in the module path. Without the /v2 suffix, v2.x tags are
unfetchable via 'go get' and uninstallable as a 'go tool', so downstream
consumers (e.g. buildkite/agent) have been pinned to v1.6.0 — which
predates the 'plan' subcommand and --collect-git-metadata.
Change module path in go.mod to github.com/buildkite/test-engine-client/v2
and rewrite all internal import paths to match. Also update the version
ldflags path in .goreleaser.yaml so release builds continue to stamp the
version string into internal/version.Version.
Once this lands and a v2.x tag is cut, downstream projects can switch to:
go get github.com/buildkite/test-engine-client/v2@vX.Y.Z
Unblocks TE-5842 (unify both bktec call sites in buildkite/agent onto
'go tool' against a current v2.x release).
Merged
Member
|
@codex review |
pda
approved these changes
May 15, 2026
Member
pda
left a comment
There was a problem hiding this comment.
🚀 assuming Codex review doesn't spot anything unexpected.
|
Codex Review: Didn't find any major issues. Bravo. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
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.
Description
The
go.modin this repo declaresmodule github.com/buildkite/test-engine-clientat every v2.x tag (v2.0.0 through v2.5.0 andmain). Go's module versioning rules require modules at v2+ to encode the major version in the module path, so v2.x tags should readmodule github.com/buildkite/test-engine-client/v2.The current state makes v2.x releases unfetchable via
go getand uninstallable as ago tool. The+incompatibleescape hatch doesn't apply because that only works for modules without ago.modfile:Downstream Go projects can install bktec as a tool (via the
tool ( ... )directive ingo.mod) only against v1.x.buildkite/agentis pinned tov1.6.0for exactly this reason — that's the most recent v1.x release, and predates theplansubcommand (v2.0.0) and--collect-git-metadata(v2.4.0).This PR:
go.modtomodule github.com/buildkite/test-engine-client/v2.*.gofiles fromgithub.com/buildkite/test-engine-client/internal/...togithub.com/buildkite/test-engine-client/v2/internal/.....goreleaser.yamlfrom.../internal/version.Versionto.../v2/internal/version.Versionso release builds continue to stampinternal/version.Versioncorrectly.Once a v2.x tag is cut on top of this commit,
go get github.com/buildkite/test-engine-client/v2@vX.Y.Zresolves and downstreamgo toolsetups work. Historical v2.0.0–v2.5.0 tags don't need to move; downstream consumers should pin to the new tag (e.g.v2.5.1) and update their import paths to include the/v2suffix.Context
Resolves TE-5843.
Surfaced in TE-5842 while trying to unify two bktec call sites in
buildkite/agent:.buildkite/steps/tests.shusesgo tool test-engine-clientagainstv1.6.0fromgo.mod..buildkite/steps/collect-commit-metadata.sh(landed via TE-5828, agent#3924) downloads thev2.5.0binary from the GitHub release at step time.Changes
Single commit:
[TE-5843] Encode v2 major version in go.mod module pathVerification
Backed by the existing test suite. The internal import rewrite is mechanical (
sed-driven) so the diff is large but uniform.go build ./... go vet ./... go test ./...go buildandgo vetare clean.go testis clean on every package exceptinternal/runner, which has the same pre-existing local-env failures onmain(missingcypress,gotestsum, andcucumberbinaries) — not regressions from this change.AI assisted.
Deployment
Low risk. No behavioural change — only the module identifier and import paths move. The compiled binary is byte-equivalent modulo the
internal/version.Versionldflag string, which is rewritten to match the new path in the same change.Unblocks
buildkite/agentand unify both call sites ongo tooloncev2.5.1(or later) is tagged on top of this commit.Rollback
Yes. Revert the merge; downstream consumers haven't been migrated yet because no v2.x tag exists with the corrected path.