-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
breaking changes from cobra v1.9.0 #5827
Comments
Ugh; thanks for reporting; it looks like Cobra introduced a cli/cli/command/completion/functions.go Lines 16 to 17 in f488a75
// Completion is a string that can be used for completions
//
// two formats are supported:
// - the completion choice
// - the completion choice with a textual description (separated by a TAB).
//
// [CompletionWithDesc] can be used to create a completion string with a textual description.
//
// Note: Go type alias is used to provide a more descriptive name in the documentation, but any string can be used.
type Completion = string
// CompletionFunc is a function that provides completion results.
type CompletionFunc func(cmd *Command, args []string, toComplete string) ([]Completion, ShellCompDirective) Looks to be introduced in spf13/cobra@8cb30f9 |
@tassa-yoniso-manasi-karoto I'm discussing with the Cobra maintainers, but also looking at workarounds on our side; would you be able to test if the changes from this PR fix the build? It's a draft PR and opened from my fork, so not merged yet (and the branch will go away eventually), but for testing if the fix work, you add a
We likely will have to do that alias either way as there's now a type defined in upstream Cobra, but I wanted to verify if that approach works, so would be great if you could test it at least fixes the issue. |
Follow up, I provided a fix Thanks again @tassa-yoniso-manasi-karoto for reporting it, and sorry for the inconvenience |
@thaJeztah apologies for the breaking change: we'll cut v1.9.1 today. Deeper integration testing is a missing piece of cobras broader test/maintenance strategy. I'd love to explore how we can prevent this type of problem for consumers (and consumers of consumers) in the future. |
Thanks everyone! Really, no stress: no harm done. Things break at times, and that's a reality of life. As to integration testing; in general we've not seen problematic issues with Cobra upgrades. Our (docker/cli, moby/moby) repositories are still in a really awkward split not being able (yet) to be an actual go module (we're getting closer, but the situation is ... complex). I definitely wouldn't want to put the burden of testing against those on the Cobra maintainers. One thing that could help is to do rc's before releases and ask projects that are interested to help verifying to run their CI against those RCs. That said, with Cobra generally not having caused major issues with upgrades, perhaps the current situation isn't too problematic; turnaround time from discovery to fix was really short, and anyone updating dependencies should look at changes before updating (to learn what changes they're accepting with the update), and test in CI. (The only thing I could see becoming useful at some point is drafting ideas for a "v2"; having looked at some parts of the code it's starting to show its age, and I have a feeling some parts start to stretch the original design, or resulted in some bloat to preserve backward compatibility). |
I can confirm this can be resolved by either using #5828 or cobra's current main branch. Thank you for the quick resolution, feel free to close the issue. |
cobra v1.9.1 was tagged, which includes the fix; let me indeed go ahead and close this one. Thanks again for reporting! |
Description
cobra v1.9.0 was just released.
I have a program that requires Docker CLI and Cobra. I have just upgraded my dependencies and and I get a compilation error:
There seems to be some breaking changes associated with Cobra.
Reproduce
Expected behavior
should compile
docker version
Client: Version: 27.5.1 API version: 1.47 Go version: go1.23.4 Git commit: tag v27.5.1 Built: Mon Jan 27 09:32:48 2025 OS/Arch: linux/amd64 Context: default Server: Engine: Version: 27.5.1 API version: 1.47 (minimum version 1.24) Go version: go1.23.4 Git commit: tag v27.5.1 Built: Mon Jan 27 09:32:48 2025 OS/Arch: linux/amd64 Experimental: false containerd: Version: 2.0.1 GitCommit: UNSET runc: Version: 1.1.13 GitCommit: docker-init: Version: 0.19.0 GitCommit:
docker info
Additional Info
No response
The text was updated successfully, but these errors were encountered: