Skip to content

fix: resolve docker/docker/api -> moby/moby/api module path mismatch - #1043

Open
shteypandey28-hue wants to merge 1 commit into
meshery:masterfrom
shteypandey28-hue:fix/go-mod-tidy-module-path-mismatch
Open

fix: resolve docker/docker/api -> moby/moby/api module path mismatch#1043
shteypandey28-hue wants to merge 1 commit into
meshery:masterfrom
shteypandey28-hue:fix/go-mod-tidy-module-path-mismatch

Conversation

@shteypandey28-hue

Copy link
Copy Markdown

Description

Resolves #963

Problem

When running go mod tidy, the build fails with:

github.com/docker/docker/api@v1.54.0: parsing go.mod:
    module declares its path as: github.com/moby/moby/api
        but was required as: github.com/docker/docker/api

This happens because Docker recently modularized their repository into sub-modules with their own go.mod files. The sub-module at github.com/docker/docker/api is a vanity import path that redirects to github.com/moby/moby - but the go.mod inside declares module github.com/moby/moby/api, causing a path mismatch.

Transitive dependencies like kubernetes/kompose, fsouza/go-dockerclient, and docker/cli can trigger this when they reference types under docker/docker/api/types/.

Fix

Added a replace directive in go.mod to redirect the Docker vanity path to the canonical Moby module:

github.com/docker/docker/api => github.com/moby/moby/api v1.55.0

This is the standard approach for handling the Docker/Moby module path divergence, consistent with the existing replace patterns 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, but v20.10.24 is a version of the root docker/docker module - not the api sub-module. The moby/moby/api sub-module uses versions v1.52.0 through v1.55.0. This PR uses v1.55.0 (latest stable).

Verification

  • go mod tidy - passes, idempotent
  • go test ./... - all packages pass
  • go vet ./... - clean
  • No unintended file changes (only go.mod modified, 1 line changed)

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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>
@shteypandey28-hue
shteypandey28-hue force-pushed the fix/go-mod-tidy-module-path-mismatch branch from 090ff47 to bceb2ff Compare June 30, 2026 10:42
@shteypandey28-hue

Copy link
Copy Markdown
Author

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.

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.

go mod tidy Fails Due to Module Path Mismatch: github.com/docker/docker/api vs github.com/moby/moby/api

1 participant