-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Unexport container commands #6299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This patch deprecates exported container commands and moves the implementation details to an unexported function. Commands that are affected include: - container.NewRunCommand - container.NewExecCommand - container.NewPsCommand - container.NewContainerCommand - container.NewAttachCommand - container.NewCommitCommand - container.NewCopyCommand - container.NewCreateCommand - container.NewDiffCommand - container.NewExportCommand - container.NewKillCommand - container.NewLogsCommand - container.NewPauseCommand - container.NewPortCommand - container.NewRenameCommand - container.NewRestartCommand - container.NewRmCommand - container.NewStartCommand - container.NewStatsCommand - container.NewStopCommand - container.NewTopCommand - container.NewUnpauseCommand - container.NewUpdateCommand - container.NewWaitCommand - container.NewPruneCommand Signed-off-by: Alano Terblanche <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request deprecates all exported container command functions in the Docker CLI and moves their implementations to unexported functions. The changes are part of a broader effort to clean up the public API and prevent direct imports of command implementations.
- Adds deprecation warnings to all exported
New*Commandfunctions - Creates new unexported
new*Commandfunctions with the actual implementation - Updates test files to use the new unexported functions
- Adds
//nolint:staticcheckcomments for continued use in command registration
Reviewed Changes
Copilot reviewed 42 out of 42 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
cli/command/container/*.go |
Container command files with deprecation wrappers and implementation moves |
cli/command/container/*_test.go |
Test files updated to use unexported functions |
cli/command/container/cmd.go |
Container command registry updated to use unexported functions |
cli/command/commands/commands.go |
Main command registry with staticcheck suppressions for deprecated functions |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
| // NewStatsCommand creates a new [cobra.Command] for "docker stats". | ||
| // | ||
| // Deprecated: Do not import commands directly. They will be removed in a future release. | ||
| func NewStatsCommand(dockerCLI command.Cli) *cobra.Command { | ||
| return newStatsCommand(dockerCLI) | ||
| } | ||
|
|
||
| func newStatsCommand(dockerCLI command.Cli) *cobra.Command { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh; just so I don't forget; when we remove the exported ones, I think it's still good to keep the GoDoc, and put those on the non-exported commands.
Admitted, most of them are rather boilerplate GoDocs, but it's still a "start", and can help encourage better documenting those where it adds value 😅
thaJeztah
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
This patch deprecates exported container commands and moves the implementation details to an unexported function.
Commands that are affected include:
- What I did
- How I did it
- How to verify it
- Human readable description for the release notes
- A picture of a cute animal (not mandatory but encouraged)