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

Generator should support Go modules #720

Closed
anuraaga opened this issue Jul 30, 2018 · 5 comments
Closed

Generator should support Go modules #720

anuraaga opened this issue Jul 30, 2018 · 5 comments

Comments

@anuraaga
Copy link

Go modules will be released soon, and the cobra generator should be updated to respect them. Currently, it always generates into GOPATH, but when run in a repository that has a go.mod file, it should instead generate into the current directory.

@matejvelikonja
Copy link

is there any workaround for this?

@tkivisik
Copy link

I believe my problem is related.

When I run cobra init or cobra add my_special_command using Go 1.11.1 in a Go project folder outside of GOPATH, having go.mod, it outputs:

Using config file: /home/user/.cobra.yaml
Error: Rel: can't make /home/user/path/to/non-gopath/my_project relative to

@artooro
Copy link

artooro commented Nov 7, 2018

I just moved the project into the GOPATH in order to use cobra init/add and then moved it back into my project folder which worked fine.
Hope at some point it will support go modules though.

@obloquy
Copy link

obloquy commented Jan 3, 2019

From bash or similar shells you can use:
$ GOPATH=$HOME/workspace cobra add my_new_command
my_new_command created at /home/me/workspace/src/.../my_project/cmd/my_new_commnd_roll.go

@noandrea noandrea mentioned this issue Feb 3, 2019
@jharshman
Copy link
Collaborator

This should be resolved by #817 .

@umarcor umarcor mentioned this issue Mar 18, 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

No branches or pull requests

6 participants