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

failed to install cobra generator and its dependencies #1191

Closed
akayj opened this issue Aug 17, 2020 · 7 comments · Fixed by #1200
Closed

failed to install cobra generator and its dependencies #1191

akayj opened this issue Aug 17, 2020 · 7 comments · Fixed by #1200
Labels
kind/bug A bug in cobra; unintended behavior

Comments

@akayj
Copy link

akayj commented Aug 17, 2020

Go version

go1.15

OS

macOS 10.15.3

What have you done?

follow the guides, run this command
go get -u github.com/spf13/cobra/cobra

What happend?

go: github.com/spf13/cobra/cobra upgrade => v0.0.0-20200815144417-81e0311edd0b go get: github.com/spf13/cobra/[email protected] requires github.com/spf13/[email protected]: reading github.com/spf13/cobra/go.mod at revision v0.0.0: unknown revision v0.0.0

expects

successfully install cobra generator and its deps

@jlhume
Copy link

jlhume commented Aug 17, 2020

+1
Possibly brought on by #1139 ?

I found running go get -u github.com/spf13/cobra instead will bring in Cobra and it can be used, but you'll have to set up your project manually, as the Cobra generator won't be provided.

@campusstella
Copy link

+1

@Adiqq
Copy link

Adiqq commented Aug 19, 2020

Works with:

go get github.com/spf13/cobra/[email protected]

@MichaelMure
Copy link
Contributor

A solution could be to set an explicit version in cobra/go.mod (the secondary go.mod for the CLI tool) but the downside is that this version need to be updated each time a new version is published (and before tagging).

I suppose the replace github.com/spf13/cobra => ../ would still work during development to make sure to use the local code with potential changes.

It's a bit silly that go modules try to get that v0.0.0 version (and fail the whole process) while this version is explicitly overridden.

@akayj
Copy link
Author

akayj commented Aug 20, 2020

A solution could be to set an explicit version in cobra/go.mod (the secondary go.mod for the CLI tool) but the downside is that this version need to be updated each time a new version is published (and before tagging).

I suppose the replace github.com/spf13/cobra => ../ would still work during development to make sure to use the local code with potential changes.

It's a bit silly that go modules try to get that v0.0.0 version (and fail the whole process) while this version is explicitly overridden.

Will this solution be marked in the doc later ?
For a dummy, I suppose a notice is welcomed.

@jharshman jharshman added kind/bug A bug in cobra; unintended behavior needs investigation labels Aug 23, 2020
jharshman added a commit to jharshman/cobra that referenced this issue Aug 23, 2020
PR spf13#1139 introduced a complexity that will have to be taken into account
as we figure out our release pipeline. This fix pins to cobrav1.0.0 as a
temporary workaround.

fixes: spf13#1191
@jharshman
Copy link
Collaborator

Oddly, I can't seem to recreate this issue on my end. Nonetheless, I have submitted a PR for the solution proposed by @MichaelMure.

@MichaelMure
Copy link
Contributor

Hmm, I'm going to ask the question, but does having viper in the CLI tool (meaning handling the flags with viper, not generating a project with viper included) actually useful ? If not, removing that support would resolve everything at once: no super heavy deps, no double go.mod needed and no weird interaction with it.

eparis pushed a commit that referenced this issue Aug 23, 2020
PR #1139 introduced a complexity that will have to be taken into account
as we figure out our release pipeline. This fix pins to cobrav1.0.0 as a
temporary workaround.

fixes: #1191
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 a pull request may close this issue.

6 participants