Skip to content
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

Remove secondary go mod to prevent broken go get #1233

Merged
merged 1 commit into from
Sep 23, 2020

Conversation

jpmcb
Copy link
Collaborator

@jpmcb jpmcb commented Sep 23, 2020

This PR addresses problems with go get in issues #1215 and #1219

The maintainers have discussed the need for a second go module. And despite the CLI package requiring a few additional modules, the pain for users around getting the cobra project as expected does not make this desirable behavior.

Therefore, this effectively reverts PR #1139

@jharshman jharshman added the kind/bug A bug in cobra; unintended behavior label Sep 23, 2020
@umarcor
Copy link
Contributor

umarcor commented Sep 25, 2020

According to the changes in this PR, ~299/313=95.5% of the dependencies correspond to the CLI package and are not required by users of the library. While I understand the motivation not to handle the complexity of having two go.mod files given the structure of the repo, describing it as "a few additional modules" feels quite unfair.

This PR decided to prioritize the pain of some users having to specify a semver, over others aiming at having an efficient ecosystem. That's ok. Yet, I wish some reference was given about the technical constraints that prevent(ed) go get github.com/spf13/cobra/cobra from working. My understanding is that the CLI should not be a child of the library, but a sibling, because the CLI is not part of the library. That would probably avoid the ambiguity, while allowing to have separate dependencies.

@marckhouzam
Copy link
Collaborator

I too wish we could have an efficient way to avoid those unnecessary imports.

From my understanding once a project is off the ground, the Cobra cli isn't really that valuable, right? And yet every project using Cobra keeps downloading it.

I'm not very versed in go packaging but the idea of siblings packages sounds interesting. In my mind, my project should depend on the library only, and I should install the cli independently if I need it.

@umarcor
Copy link
Contributor

umarcor commented Sep 25, 2020

@marckhouzam, I would say that we'll all agree on that. The problem is how to deal with it. This repo is in spf13's namespace; hence options are:

  • Create spf13/cobra-cli, and move the CLI there.
  • Create org cobra and move cobra/lib, cobra/cobra, cobra/cli, whatever.
  • Move the current content in the root of this repo (except subdir 'cobra') to a new subdir (say 'lib'). Probably rename 'cobra' to 'cli'.

I prefer the last option, as the result would be:

  • go get github.com/spf13/cobra/lib
  • go get github.com/spf13/cobra/cli

each with a separate go.mod and go.sum file, but both together in the same git history.

Nevertheless, the problem is that any of those are breaking changes. My conviction is that, the later it's fixed, the worse it will be. However, I ain't a maintainer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in cobra; unintended behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants