[carry 4116] switch to go module - #7299
Open
AkihiroSuda wants to merge 5 commits into
Open
Conversation
Rename vendor.mod/vendor.sum to go.mod/go.sum, making this repository a proper Go module. This removes the machinery that was needed to work around the absence of a go.mod: - scripts/with-go-mod.sh, which symlinked vendor.mod/vendor.sum into place for commands that require a module; - the equivalent symlink dances in the CodeQL and test workflows, and in Dockerfile.lint; - the "GO111MODULE=auto" overrides in the Makefile, build scripts, and Dockerfiles; - internal/gocompat, which verified that our packages are consumable in module mode. With a real go.mod, the "go" directive sets the language version for all packages in the module, so the "//go:build go1.xx" workaround it guarded is no longer needed. Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com> Assisted-by: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
The "docker-trust" plugin lives in a nested module, and reaches into
the root module's "internal/" packages. That works today because its
module path ("github.com/docker/cli/cmd/docker-trust") is a prefix
match for "github.com/docker/cli/internal/...".
Once the root module gains a major-version suffix, the internal path
becomes "github.com/docker/cli/v29/internal/...", which the nested
module is no longer allowed to import ("use of internal package ...
not allowed").
Folding the plugin back into the root module is not an option: notary
and its dependencies pull in ~45 additional modules (MySQL, SQLite,
bugsnag, gorm, ...) which is exactly why it was split out.
So copy the four small helpers it uses into the plugin's own internal
tree instead.
Assisted-by: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
Go modules require a major-version suffix in the module path for major versions >= 2, so the module becomes "github.com/docker/cli/v29" and all import paths are updated accordingly. Note that this means the import paths have to be updated on every major (CalVer) bump of the CLI. Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com> Assisted-by: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
The repository is a Go module now, so the test workflow no longer has to check out into a GOPATH-shaped directory. The remaining GOPATH use in scripts/test/e2e/run is unrelated: the e2e suite installs a test plugin into $GOPATH/bin. Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com> Assisted-by: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
These were added because the repository was not a module: consumers got an implicitly generated go.mod, which made go assume the "go1.16" language version and reject any newer language feature. The "//go:build" directive overrode the language version on a per-file basis. Now that there is a real go.mod, its "go" directive sets the language version for every file in the module, so the workaround can go, as the FIXME they carried asked for. Assisted-by: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
AkihiroSuda
commented
Sep 11, 2026
| // 'vendor.mod' enables use of 'go mod vendor' to managed 'vendor/' directory. | ||
| // There is no 'go.mod' file, as that would imply opting in for all the rules | ||
| // around SemVer, which this repo cannot abide by as it uses CalVer. | ||
| module github.com/docker/cli/v29 |
Collaborator
Author
There was a problem hiding this comment.
(Possibly this should be bumped up to v30?)
This was referenced Sep 11, 2026
Collaborator
Author
Submitted test PRs: |
Closed
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.
- What I did
Carry:
- How I did it
Asked Claude to carry #4116 and reviewed the result
- How to verify it
- Human readable description for the release notes
- A picture of a cute animal (not mandatory but encouraged)