Include the version of `go-github` in `User-Agent` headers sent to the GitHub API
👋🏻 Hi there! I'm Tim, and I'm a Product Manager at GitHub. To allow us to better understand how people are using our API, it's super helpful to know what versions of SDKs like go-github they are using.
At the moment, this package sends the User-Agent "go-github" in requests, but it doesn't say what version is being used.
This updates the User-Agent header to include that information, whilst still maintaining the ability for people to choose their own user agent by setting the UserAgent field on Client.
It also exports a Version constant, so people can use that information - for example to construct custom User-Agent headers.
This will mean that someone has to update the Version constant with the new version when it is incremented.
This is the first ever Go I've written, so I won't be upset if you tell me that I've done this in a terrible way 😉
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
View this failed invocation of the CLA check for more information.
For the most up to date status, view the checks section at the bottom of the pull request.
Codecov Report
Merging #2403 (7279ad7) into master (fd22ee9) will not change coverage. The diff coverage is
100.00%.
@@ Coverage Diff @@
## master #2403 +/- ##
=======================================
Coverage 98.06% 98.06%
=======================================
Files 119 119
Lines 10546 10546
=======================================
Hits 10342 10342
Misses 140 140
Partials 64 64
| Impacted Files | Coverage Δ | |
|---|---|---|
| github/github.go | 97.80% <100.00%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update fd22ee9...7279ad7. Read the comment docs.
Thank you, @raynigon ! Merging.