gitmyhub

go-github

Go ★ 11k updated 1d ago

Go library for accessing the GitHub v3 API

go-github is a Go library maintained by Google that lets your programs talk to GitHub's REST API, read repos, manage issues, and automate GitHub tasks without writing networking code.

Gosetup: easycomplexity 2/5

go-github is a library written in Go that lets developers talk to GitHub's official API from their own programs. If you are building a tool that needs to read repositories, manage issues, list organizations, or do anything else that GitHub's website does, this library gives you a ready-made set of functions to do that without writing the low-level networking code yourself.

The library is maintained by Google and covers a large portion of GitHub's REST API (version 3). It organizes the API into logical groups, so functions for working with repositories are in one place, functions for organizations are in another, and so on. This mirrors how GitHub's own documentation is structured, making it easier to find what you need.

Authentication is built in. You can connect as a regular user by providing a personal access token, or you can connect as a GitHub App, which is a special kind of automated account that acts on behalf of an installation. The README shows examples of both approaches using third-party helper packages.

The library also handles GitHub's rate limiting. GitHub restricts how many requests any client can make in a given window of time. go-github exposes the rate limit information from every API response so your program can check how close it is to the limit and slow down or wait before sending more requests. There is also built-in support for secondary rate limits, which apply to specific actions like creating content too quickly.

Additional features include automatic pagination for endpoints that return long lists, support for GitHub's conditional request system (which saves bandwidth by skipping responses that have not changed), and a scrubber that can remove sensitive tokens from logs. The library follows Go's standard module system, so adding it to a project is a single command.

Where it fits