fix: resolve docker/docker/api -> moby/moby/api module path mismatch - #1043
fix: resolve docker/docker/api -> moby/moby/api module path mismatch#1043shteypandey28-hue wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the go.mod file by removing a commented-out replacement for github.com/docker/docker and adding a replacement mapping github.com/docker/docker/api to github.com/moby/moby/api v1.55.0. There are no review comments, so I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
The github.com/docker/docker/api sub-module declares its module path as github.com/moby/moby/api in its go.mod, causing 'go mod tidy' to fail with a module path mismatch error when transitive dependencies (e.g., kubernetes/kompose, fsouza/go-dockerclient) resolve this sub-module. Add a replace directive to redirect github.com/docker/docker/api to the canonical github.com/moby/moby/api module path. Signed-off-by: shrey <shrey@meshery.io> Resolves meshery#963 Signed-off-by: shteypandey28-hue <shteypandey28@gmail.com>
090ff47 to
bceb2ff
Compare
|
Hey @YASHMAHAKAL ,Added a replace directive in go.mod to map docker/docker/api to moby/moby/api since the sub-module declares itself as moby/moby/api but gets fetched via the docker vanity path. Used v1.55.0 instead of the v20.10.24+incompatible suggested in the issue since that version belongs to the root module, not the /api sub-module. Tested locally — go mod tidy, go test, and go vet all pass clean. |
Description
Resolves #963
Problem
When running
go mod tidy, the build fails with:This happens because Docker recently modularized their repository into sub-modules with their own
go.modfiles. The sub-module atgithub.com/docker/docker/apiis a vanity import path that redirects togithub.com/moby/moby- but thego.modinside declaresmodule github.com/moby/moby/api, causing a path mismatch.Transitive dependencies like
kubernetes/kompose,fsouza/go-dockerclient, anddocker/clican trigger this when they reference types underdocker/docker/api/types/.Fix
Added a
replacedirective ingo.modto redirect the Docker vanity path to the canonical Moby module:This is the standard approach for handling the Docker/Moby module path divergence, consistent with the existing
replacepatterns already in the project (e.g.,Sirupsen/logrus => sirupsen/logrus).Why not the suggested fix from the issue?
The issue suggested
replace github.com/docker/docker/api => github.com/moby/moby/api v20.10.24+incompatible, butv20.10.24is a version of the rootdocker/dockermodule - not theapisub-module. Themoby/moby/apisub-module uses versionsv1.52.0throughv1.55.0. This PR usesv1.55.0(latest stable).Verification
go mod tidy- passes, idempotentgo test ./...- all packages passgo vet ./...- cleango.modmodified, 1 line changed)