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

cobra init no longer works as documented #888

Closed
wants to merge 1 commit into from
Closed

cobra init no longer works as documented #888

wants to merge 1 commit into from

Conversation

DazWilkin
Copy link

cobra init github.com/spf13/newApp results in Error: required flag(s) "pkg-name" not set

This alternative works but it's not intuitive to me as a noob user that it's correct.

In order to test what it does, I tried cobra init a --pkg-name=b but then main.go attempts to (incorrectly) import "b/cmd"

I think (!?) I'd expect what you original had: cobra init github.com/spf13/newApp creating a directory under {GOPATH}/src/github.com/spf13/newApp with github.com/spf13/newApp as the package name.

`cobra init github.com/spf13/newApp` results in `Error: required flag(s) "pkg-name" not set`

This alternative works but it's not intuitive to me as a noob user that it's correct.

In order to test what it does, I tried `cobra init a --pkg-name=b` but then `main.go` attempts to (incorrectly) `import "b/cmd"`

I think (!?) I'd expect what you original had: `cobra init github.com/spf13/newApp` creating a directory under `{GOPATH}/src/github.com/spf13/newApp` with `github.com/spf13/newApp` as the package name.
@CLAassistant
Copy link

CLAassistant commented Jun 17, 2019

CLA assistant check
All committers have signed the CLA.

@jharshman
Copy link
Collaborator

jharshman commented Jun 18, 2019

@DazWilkin #817
This was updated to ensure that the generator works outside the GoPath and with Go Modules. The overarching goal was to decouple the generator from the GoPath as much as possible.

You should be able to use the generator successfully by entering the directory in which you want to init a project, and running
cobra init --pkg-name github.com/<org>/<pkg>

In sum, the documentation for the generator should probably be updated.

Copy link
Collaborator

@jharshman jharshman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation should accurately reflect the proper usage of the cobra generator as it exists today.

@umarcor
Copy link
Contributor

umarcor commented Jun 24, 2019

Ref #878.

@umarcor umarcor mentioned this pull request Jul 6, 2019
@jharshman jharshman mentioned this pull request Jul 10, 2019
@jharshman
Copy link
Collaborator

covered by #904

@jharshman jharshman closed this Jul 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants