You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This way I could reuse it when using the CLI programmatically in go. Right now since its located inside the internal directory its not usable outside it https://golang.org/doc/go1.4#internalpackages
Here's an example. I want to programmatically create PRs. So my code looks like the following
baseRepository, err := api.GitHubRepo(client, baseRepo)
if err != nil {
return errors.WithStack(errors.Wrapf(err, "There was an error getting repository information."))
}
pr, err := api.CreatePullRequest(client, baseRepository, params)
if err != nil {
return errors.WithStack(errors.Wrapf(err, "Failed to create pull request"))
}
So I want to call api.GitHubRepo which requires an argument of type ghrepo.Interface. I don't really want to define my own implementation jut by copying the code in ghrepo. I would rather just reuse it.
The text was updated successfully, but these errors were encountered:
Hi, thanks for explaining how you would use our Go packages.
Personally, I would not recommend importing any packages from our repository into your project other than those under github.com/cli/cli/pkg/*. Currently, our largest packages are command and api, but neither are really suitable for using as a library, since they were not intended to be used that way.
Furthermore, we intentionally put some newer packages under internal/ because they might keep changing and we want to discourage people from importing them.
For your use case I would strongly suggest that, instead of using github.com/cli/cli/api to create pull requests, you should use the github.com/shurcooL/githubv4 library directly for all your GitHub API needs. This will provide greater level of control and long-term stability for your Go project.
Describe the feature or problem you’d like to solve
I would like ghrepo to be a public package
https://github.com/cli/cli/tree/trunk/internal/ghrepo
This way I could reuse it when using the CLI programmatically in go. Right now since its located inside the internal directory its not usable outside it
https://golang.org/doc/go1.4#internalpackages
Here's an example. I want to programmatically create PRs. So my code looks like the following
So I want to call
api.GitHubRepo
which requires an argument of typeghrepo.Interface
. I don't really want to define my own implementation jut by copying the code in ghrepo. I would rather just reuse it.The text was updated successfully, but these errors were encountered: