Package inventory for Go module migration

未关闭
#7,413 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
go
领域
cli

调研方向

Start with the package inventory in the issue, grouped by consumers, subcommands, the legacy Compose loader, and other packages. Review the listed importers and consumer dependencies, then record a decision beneath each package; done means the inventory reflects which packages should remain public or move to internal. This is broad API design work, and the issue names no source files or tests to start from.

由索引模型根据 Issue 内容生成。

描述

Adopting Go modules changes the import path of every public package.
That makes it a good moment to decide which packages we keep public and which we can break or move to internal/.
Tick an item once we've decided on it, and write the decision under it.

How to read the notes:

  • "Consumers" are repos we checked by hand: X buildx, C compose, K buildkit, G go-containerregistry, T testcontainers-go, M model-runner, P mcp-gateway, D cmd/docker-trust.
  • "Importers" are other high-profile repos whose current default branch imports the package outside test files.
    High profile means at least 1,000 stars and not archived; the star count is in parentheses.
    The list is based on pkg.go.dev importer data, checked against each repo's current source.
Imported by the checked consumers
  • cli
    • Consumers: buildx, compose, cmd/docker-trust.
    • Importers: aquasecurity/trivy (39k), keploy/keploy (19k), werf/werf (4.7k), docker/docker-agent (4.4k), ddev/ddev (3.9k), opencurve/curve (2.4k).
  • cli/command
    • Consumers: buildx, compose, testcontainers-go, model-runner, mcp-gateway, cmd/docker-trust.
    • Importers: portainer/portainer (39k), aquasecurity/trivy (39k), keploy/keploy (19k), tilt-dev/tilt (10k), alibaba/higress (9.6k), getarcaneapp/arcane (7.9k), k3d-io/k3d (6.6k), psviderski/uncloud (5.5k), werf/werf (4.7k), nicholas-fedor/watchtower (4.6k), docker/docker-agent (4.4k), ddev/ddev (3.9k), supabase/cli (2.4k), opencurve/curve (2.4k), shellhub-io/shellhub (2.1k), zarf-dev/zarf (2.1k), kimdre/doco-cd (1.7k), datastack-net/dockerized (1.3k).
    • Its Cli interface is the main API we commit to.
  • cli/command/container
    • Consumers: compose only.
    • Compose uses RunExec, NewExecOptions, RunAttach, AttachOptions, RunStats, RunStart and ForwardAllSignals.
    • Importers: none.
    • A small public package with just these functions would let this one go internal.
  • cli/command/formatter
    • Consumers: buildx, compose, cmd/docker-trust.
    • Importers: none.
  • cli/command/image/build
    • Consumers: compose only (the classic builder's build-context helpers).
    • Importers: loft-sh/devspace (5.2k), digitalocean/doctl (3.5k).
  • cli/command/inspect
    • Consumers: cmd/docker-trust.
    • Importers: none.
  • cli/config
    • Consumers: buildx, compose, buildkit, go-containerregistry, mcp-gateway, cmd/docker-trust.
    • Importers: nektos/act (72k), wagoodman/dive (55k), jesseduffield/lazydocker (53k), aquasecurity/trivy (39k), 1Panel-dev/1Panel (37k), kubernetes/minikube (32k), dagger/dagger (16k), GoogleContainerTools/skaffold (16k), loft-sh/devpod (15k), earthly/earthly (12k), kubescape/kubescape (12k), loft-sh/vcluster (11k), containerd/nerdctl (10k), tilt-dev/tilt (10k), replicate/cog (9.5k), rancher-sandbox/rancher-desktop (7.4k), azukaar/cosmos-server (6.2k), psviderski/uncloud (5.5k), tsuru/tsuru (5.3k), loft-sh/devspace (5.2k), werf/werf (4.7k), alexellis/arkade (4.6k), nicholas-fedor/watchtower (4.6k), docker/docker-agent (4.4k), whalebrew/whalebrew (4.2k), genuinetools/img (4.0k), okteto/okteto (3.6k), gardener/gardener (3.5k), digitalocean/doctl (3.5k), openfaas/faasd (3.3k), inspektor-gadget/inspektor-gadget (2.9k), supabase/cli (2.4k), aws/eks-anywhere (2.1k), shellhub-io/shellhub (2.1k), apptainer/apptainer (2.0k), project-copacetic/copacetic (1.7k), kimdre/doco-cd (1.7k), genuinetools/reg (1.7k), dragonflyoss/nydus (1.7k), containerd/stargz-snapshotter (1.6k), ktock/buildg (1.5k), solo-io/bumblebee (1.3k), railwayapp/railpack (1.2k), gitlab-org/cli on GitLab (1.1k).
    • Covered by the open PR that extracts config into its own module (#6210).
  • cli/config/configfile
    • Consumers: buildx, compose, buildkit, go-containerregistry, mcp-gateway, cmd/docker-trust.
    • Importers: istio/istio (38k), hashicorp/nomad (17k), dagger/dagger (16k), GoogleContainerTools/skaffold (16k), loft-sh/devpod (15k), earthly/earthly (12k), loft-sh/vcluster (11k), containerd/nerdctl (10k), replicate/cog (9.5k), woodpecker-ci/woodpecker (8.0k), unkeyed/unkey (5.5k), tsuru/tsuru (5.3k), loft-sh/devspace (5.2k), nicholas-fedor/watchtower (4.6k), runfinch/finch (4.1k), genuinetools/img (4.0k), okteto/okteto (3.6k), openfaas/faasd (3.3k), envoyproxy/gateway (3.1k), inspektor-gadget/inspektor-gadget (2.9k), gitlab-org/gitlab-runner on GitLab (2.6k), aws/eks-anywhere (2.1k), apptainer/apptainer (2.0k), kimdre/doco-cd (1.7k), containerd/stargz-snapshotter (1.6k).
  • cli/config/types
    • Consumers: buildx, compose, buildkit, go-containerregistry.
    • Importers: portainer/portainer (39k), aquasecurity/trivy (39k), istio/istio (38k), kubesphere/kubesphere (17k), hashicorp/nomad (17k), dagger/dagger (16k), GoogleContainerTools/skaffold (16k), loft-sh/devpod (15k), loft-sh/vcluster (11k), containerd/nerdctl (10k), replicate/cog (9.5k), woodpecker-ci/woodpecker (8.0k), getarcaneapp/arcane (7.9k), unkeyed/unkey (5.5k), tsuru/tsuru (5.3k), loft-sh/devspace (5.2k), werf/werf (4.7k), alexellis/arkade (4.6k), nicholas-fedor/watchtower (4.6k), genuinetools/img (4.0k), okteto/okteto (3.6k), gardener/gardener (3.5k), digitalocean/doctl (3.5k), envoyproxy/gateway (3.1k), inspektor-gadget/inspektor-gadget (2.9k), gitlab-org/gitlab-runner on GitLab (2.6k), apptainer/apptainer (2.0k), kimdre/doco-cd (1.7k), genuinetools/reg (1.7k).
  • cli/connhelper
    • Consumers: model-runner.
    • Importers: nektos/act (72k), traefik/traefik (65k), wagoodman/dive (55k), GoogleContainerTools/skaffold (16k), yusing/godoxy (4.2k), DataDog/datadog-agent (3.8k), buildpacks/pack (3.0k).
  • cli/connhelper/commandconn
    • Consumers: buildkit.
    • Importers: dagger/dagger (16k), psviderski/uncloud (5.5k), docker/docker-agent (4.4k).
  • cli/context
    • Consumers: buildx.
    • Importers: none.
  • cli/context/docker
    • Consumers: buildx, compose, model-runner.
    • Importers: wagoodman/dive (55k), jesseduffield/lazydocker (53k), kubernetes/minikube (32k), replicate/cog (9.5k), zarf-dev/zarf (2.1k).
  • cli/context/store
    • Consumers: buildx, compose.
    • Importers: wagoodman/dive (55k), jesseduffield/lazydocker (53k), kubernetes/minikube (32k), replicate/cog (9.5k), kimdre/doco-cd (1.7k).
  • cli/debug
    • Consumers: buildx, cmd/docker-trust.
    • Importers: none.
  • cli/flags
    • Consumers: buildx, compose, testcontainers-go, model-runner, mcp-gateway, cmd/docker-trust.
    • Importers: portainer/portainer (39k), aquasecurity/trivy (39k), keploy/keploy (19k), tilt-dev/tilt (10k), alibaba/higress (9.6k), getarcaneapp/arcane (7.9k), k3d-io/k3d (6.6k), psviderski/uncloud (5.5k), werf/werf (4.7k), nicholas-fedor/watchtower (4.6k), docker/docker-agent (4.4k), ddev/ddev (3.9k), supabase/cli (2.4k), shellhub-io/shellhub (2.1k), zarf-dev/zarf (2.1k), kimdre/doco-cd (1.7k), datastack-net/dockerized (1.3k).
  • cli/streams
    • Consumers: buildx, compose, cmd/docker-trust.
    • Importers: psviderski/uncloud (5.5k), loft-sh/devspace (5.2k), ovh/cds (4.8k), ddev/ddev (3.9k), supabase/cli (2.4k), sealerio/sealer (2.1k), iximiuz/cdebug (1.7k).
  • cli-plugins/hooks
    • Consumers: compose.
    • Importers: none.
  • cli-plugins/manager
    • Consumers: compose, mcp-gateway.
    • Importers: ddev/ddev (3.9k).
  • cli-plugins/metadata
    • Consumers: buildx, compose, model-runner, cmd/docker-trust.
    • Importers: docker/docker-agent (4.4k).
  • cli-plugins/plugin
    • Consumers: buildx, compose, model-runner, mcp-gateway, cmd/docker-trust.
    • Importers: docker/docker-agent (4.4k).
  • opts
    • Consumers: buildx, compose, cmd/docker-trust.
    • Importers: nektos/act (72k), siderolabs/talos (11k), containerd/nerdctl (10k), tilt-dev/tilt (10k), getarcaneapp/arcane (7.9k), k3d-io/k3d (6.6k), psviderski/uncloud (5.5k), moncho/dry (3.3k), gitlab-org/gitlab-runner on GitLab (2.6k), kimdre/doco-cd (1.7k).
  • pkg/kvfile
    • Consumers: compose.
    • Importers: none.
Public only because other packages use them

None of the checked consumers import these directly.
Of these, only cli/config/credentials appears in the exported API of the packages above.

  • cli/config/credentials
    • Must stay public as long as configfile does, because ConfigFile.GetCredentialsStore returns credentials.Store.
    • Importers: nektos/act (72k), nicholas-fedor/watchtower (4.6k), aws/eks-anywhere (2.1k), kimdre/doco-cd (1.7k).
  • cli/config/memorystore
    • Importers: none.
  • cli/connhelper/ssh
    • Importers: none.
  • cli/command/formatter/tabwriter
    • Importers: none.
  • cli/hints
    • Importers: none.
  • cli/version
    • This is the -X ldflags target in scripts/build/.variables; see the version-string item below.
    • Importers: ddev/ddev (3.9k).
    • ddev sets version.Version at runtime to change the User-Agent.
    • NewAPIClientFromFlags always uses UserAgent(), so ddev has no other way to do this today.
  • cli-plugins/socket
    • Importers: none.
  • templates
    • Importers: containerd/nerdctl (10k), moncho/dry (3.3k).
    • Plugins might want it for --format.
Subcommand packages

cli/command/image already says "Do not import commands directly".

  • cli/command/builder
    • Importers: none.
  • cli/command/checkpoint
    • Importers: none.
  • cli/command/commands
    • Importers: werf/werf (4.7k).
  • cli/command/completion
    • Importers: none.
    • Its shell-completion helpers might be useful to plugins.
  • cli/command/config
    • Importers: none.
  • cli/command/context
    • Importers: none.
  • cli/command/idresolver
    • Importers: none.
    • task.Print takes an idresolver.IDResolver, so it must stay public as long as task does.
  • cli/command/image
    • Importers: none.
  • cli/command/manifest
    • Importers: none.
  • cli/command/network
    • Importers: none.
  • cli/command/node
    • Importers: none.
  • cli/command/plugin
    • Importers: none.
  • cli/command/registry
    • Importers: none.
  • cli/command/secret
    • Importers: none.
  • cli/command/service
    • Importers: none.
  • cli/command/service/progress
    • Importers: offen/docker-volume-backup (4.1k), kimdre/doco-cd (1.7k).
  • cli/command/stack
    • Importers: none.
  • cli/command/swarm
    • Importers: none.
  • cli/command/swarm/progress
    • Importers: none.
  • cli/command/system
    • Importers: none.
  • cli/command/system/pruner
    • Importers: none.
  • cli/command/task
    • Importers: none.
  • cli/command/volume
    • Importers: none.
Legacy docker stack compose loader

loader, convert and types expose internal/volumespec types through aliases such as types.ServiceVolumeConfig = volumespec.VolumeConfig.
In practice, that makes those internal types public too.

  • cli/compose/loader
    • Importers: nektos/act (72k), portainer/portainer (39k), goodrain/rainbond (6.3k), buildpacks/pack (3.0k), supabase/cli (2.4k), kimdre/doco-cd (1.7k).
  • cli/compose/types
    • Importers: portainer/portainer (39k), goodrain/rainbond (6.3k), buildpacks/pack (3.0k), kimdre/doco-cd (1.7k).
    • The loader and convert APIs use it.
  • cli/compose/convert
    • Importers: portainer/portainer (39k), kimdre/doco-cd (1.7k).
  • cli/compose/schema
    • Importers: portainer/portainer (39k), kimdre/doco-cd (1.7k).
  • cli/compose/schema/data
    • Importers: none.
  • cli/compose/interpolation
    • The loader API uses its Options type.
    • Importers: none.
  • cli/compose/template
    • The loader and interpolation APIs use its Mapping type.
    • Importers: none.
Other
  • cli/manifest/store
    • Its API uses types from cli/manifest/types.
    • Importers: none.
  • cli/manifest/types
    • Importers: none.
  • opts/swarmopts
    • Importers: none.
  • e2e/testutils
    • Importable but test-only.
    • Importers: none.
  • cmd/docker/winresources
    • Contains only package documentation.
    • Importers: none.
Related issues in this PR
  • -X ldflags path for cli/version
    • The path becomes github.com/docker/cli/v29/cli/version, so it changes in 29.10.0 and again at every new major version.
    • Go silently ignores -X for a symbol that doesn't exist, so a stale path produces a binary that reports the wrong version, with no error.
    • Homebrew and Void hard-code the old path, and Debian's docker-team rules build it from CLI_PKG.
    • Nix, Arch and Alpine build with make dynbinary, so they pick up the new path automatically.
    • If cli/version moves to internal/, do it in the same release so the path only changes once.
主要语言
Go
星标
6.1k
派生
2.2k
平均合并
1 天 8 小时
30 天内合并 PR
62

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

docker/cli 的其他 Issue

查看 docker/cli 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。