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

Vgo #817

Merged
merged 28 commits into from
Jun 7, 2019
Merged

Vgo #817

merged 28 commits into from
Jun 7, 2019

Conversation

jharshman
Copy link
Collaborator

Moves to resolve Issue #756

This was a re-work of the cobra code generator to allow it to work outside of the GOPATH and hence be compatible with Go modules (vgo) introduced in Go 1.11. This change introduces a new flag to the init command and deprecates the --package flag from the add command. With all these changes the flows remains relatively the same. Any exceptions are outlined below.

Changes

  • Add a --pkg-name flag to the init command which takes a string representing the package name.
    e.g: --pkg-name github.com/spf14/hugo
  • For adding commands, you should be inside your project root.
  • Init will no longer fail on non-empty directories.

@ironsalsa
Copy link

I ran into what this fixes today. Upvote to anything that lets us use the Go Modules way of life, as some of my projects have been moved over by necessity and I'm missing the generator!

@jharshman
Copy link
Collaborator Author

jharshman commented Feb 12, 2019

@ironsalsa Yeah I think there is a lot of desire for this feature, but it's not really getting much attention from the maintainers.

@eparis
Copy link
Collaborator

eparis commented Feb 12, 2019

I'm actually hoping to take a look at all of the vgo PRs today.... hopefully. I know we need it.

@jharshman
Copy link
Collaborator Author

👍 that would be awesome @eparis thanks!!

@shawncatz
Copy link

👍

@jharshman
Copy link
Collaborator Author

@eparis were you able to review this PR?

@bufdev bufdev mentioned this pull request Mar 8, 2019
@umarcor umarcor mentioned this pull request Mar 18, 2019
@eine
Copy link

eine commented Apr 5, 2019

ping...

@kyriediculous
Copy link

@eparis So it's been a few months now, did you manage to review it?

This is a high priority PR...

@jharshman
Copy link
Collaborator Author

I've been using my fork of this for some time just to ensure that the usage makes sense and is stable.
So far so good. I'm going to do a little clean up and rebase against upstream.

@williamokano
Copy link

Still nothing from the maintainers? This feature would be awesome :)

@jozuenoon
Copy link

🏓

@tsal
Copy link

tsal commented May 7, 2019

@jharshman since it doesn't look like we're ever going to hear back from the maintainers on this - can you provide a write-up of how you got this working locally? I tried checking out your branch and doing a "go install ." but the binary doesn't recognize the new flag. I suspect I'm missing something dreadfully obvious.

@jharshman
Copy link
Collaborator Author

jharshman commented May 7, 2019

@tsal go install works for me. Make sure you have the branch checked out in your $GOPATH and run go install github.com/spf13/cobra/cobra

@andrewmeissner
Copy link

@spf13 ping

@gmelillo
Copy link

gmelillo commented May 9, 2019

Some news about that?
will be really useful to have it merged

@umarcor
Copy link
Contributor

umarcor commented May 9, 2019

@jharshman since it doesn't look like we're ever going to hear back from the maintainers on this - can you provide a write-up of how you got this working locally? I tried checking out your branch and doing a "go install ." but the binary doesn't recognize the new flag. I suspect I'm missing something dreadfully obvious.

I hope that the following example is useful to you:

#!/bin/sh

cat > run.sh <<-EOF
apk add git
git clone -b vgo https://github.com/jharshman/cobra cobra
cd cobra/cobra
go install
cobra init --pkg-name github.com/pkg/name
EOF

$(command -v winpty) docker run --rm -it golang:alpine sh -c "$(cat run.sh)"

@umarcor umarcor mentioned this pull request May 9, 2019
@broady broady requested review from bep and eparis May 18, 2019 19:52
Copy link

@tsal tsal left a comment

Choose a reason for hiding this comment

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

When I get a review button, I'm gonna use it.

@spf13 spf13 merged commit 2411ac5 into spf13:master Jun 7, 2019
@jharshman jharshman mentioned this pull request Jul 8, 2019
jharshman added a commit to jharshman/cobra that referenced this pull request Jul 10, 2019
Update Generator Docs to reflect changes brought in spf13#817
@jharshman jharshman mentioned this pull request Jul 10, 2019
jharshman added a commit to jharshman/cobra that referenced this pull request Jul 12, 2019
Update Generator Docs to reflect changes brought in spf13#817
jharshman added a commit to jharshman/cobra that referenced this pull request Jul 16, 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.