shurcooL / Go-Package-Store

An app that displays updates for the Go packages in your GOPATH.
MIT License
900 stars 29 forks source link

Document GO_PACKAGE_STORE_GITHUB_TOKEN env var to provide a GitHub token (for higher rate limit, private repos). #85

Closed hgfischer closed 6 years ago

hgfischer commented 7 years ago

Hello @shurcooL

I have a github.token set in my ~/.gitconfig that works fine with https://github.com/tcnksm/ghr for example, but I could not find a way to do this with Go-Package-Store.

I also have some private git repositories that Go-Package-Store cannot scan.

dmitshur commented 7 years ago

Hi @hgfischer,

Thanks for asking. It's possible to provide a GitHub token for Go Package Store to use by setting the GO_PACKAGE_STORE_GITHUB_TOKEN environment variable. (You can see it in code here.)

It tells you that in the error message if you happen to exceed the unauthenticated GitHub API rate limit (see it in code here). But perhaps it'd be even better if I also mentioned this in the usage text and in README. I'll use this issue to track that.

hgfischer commented 6 years ago

Thanks for the help. Yes, would be nice to have this documented.

Wouldn't it be interesting to also add support for the same configuration from .gitconfig?

This can easily be done with the package github.com/tcnksm/go-gitconfig which is the same ghr uses.

For example: https://github.com/tcnksm/ghr/pull/8/commits/06a0e5955248abab9650e3d014c7051627abda5b

dmitshur commented 6 years ago

Supporting additional ways to provide the github access token, such as via .gitconfig is something we can consider. I plan to use this issue to track documenting GO_PACKAGE_STORE_GITHUB_TOKEN env var only. If you want the .gitconfig feature, please file that in a separate issue.