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

Cannot go get github.com/cli/cli/v2 v2.0.0 #4192

Closed
heaths opened this issue Aug 24, 2021 · 6 comments · Fixed by #4199
Closed

Cannot go get github.com/cli/cli/v2 v2.0.0 #4192

heaths opened this issue Aug 24, 2021 · 6 comments · Fixed by #4199
Labels
bug Something isn't working

Comments

@heaths
Copy link
Contributor

heaths commented Aug 24, 2021

With extension support, some extensions might want to take advantage of public APIs and need to `go get github.com/cli/cli/v2@v2.0.0 but go errs:

This is apparently because go.mod needs to specify "v2" now that it has progressed to a v2 version: https://github.com/golang/go/wiki/Modules#releasing-modules-v2-or-higher

@heaths heaths added the bug Something isn't working label Aug 24, 2021
@vilmibm
Copy link
Contributor

vilmibm commented Aug 25, 2021

gh is by intention not go gettable; it is not intended to be used as a library and our Go API has no guarantees of consistency or documentation. We are working on a Go SDK for extension authors to import that will extract the parts of gh we want to expose as a public API.

@mislav
Copy link
Contributor

mislav commented Aug 25, 2021

Even though our project is not go-gettable for other reason (#1389), I do agree we should rename our module from github.com/cli/cli to github.com/cli/cli/v2 in accordance with Go's versioning guidelines that are sometimes enforced through its tooling. I've opened a PR.

@heaths
Copy link
Contributor Author

heaths commented Aug 25, 2021

A separate module for extension developers makes a lot of sense. Combined with #4194 having a complete solution for binary extensions would be fantastic. For example, your gh function and refactoring a bunch of the formatting code you use in your built-in commands (like I use in heaths/gh-label) would be helpful and help provide a consistent experience.

Additionally, for script developers maybe some command that gh defines that could take JSON (even invalid JSON that gh api --pageable produces, or if that was fixed for #1268 even better) and apply a --template would be great for table or other output for a consistent feel.

@heaths
Copy link
Contributor Author

heaths commented Aug 25, 2021

Is there already another issue open on creating a go-gettable module for extension developers? I'd love to pile on a few ideas before PR #4199 closes this.

For example, in addition to the ideas above, providing some mechanic to pass -R or --repo to override the repo as gh itself does would be great. I did that in heaths/gh-label@6742df3 (does a few more things, but mostly handling -R) which more simplistically mimics what gh does. Not hard, but seems that a "global" option like -R should just work - at least if extension developers choose to opt into that.

@vilmibm
Copy link
Contributor

vilmibm commented Sep 2, 2021

Ah no there is not yet an issue, but there should be! feel free to open one, @heaths . CC @samcoe since he has already started on that work.

@heaths
Copy link
Contributor Author

heaths commented Sep 2, 2021

#4264

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants