Abstract
Maintaining an open-source API client takes some effort. Not only do you have to reflect the API, you also want to provide the best developer experience possible. This talk is about best practices you should use when writing Go API clients while maintaining flexibility & stability in the long term.
Algolia’s core product is a distributed search API; therefore, it must provide a developer-friendly and stable API client. Thanks to what we’ve learned from our users and our own experiences, we’re going to discuss best practices on how to reach those goals when designing and implementing a Go API client.
Compared to other programming languages, which offer looser constraints (typing system, more granular control over visibility, etc.) or more high-level abstractions (genericity, default arguments, etc.), Go feels minimal. To provide high-quality packages, you have to be creative. When it was time to release the new major version of our Go API client, we made sure to explore and use every possible feature of the language, as well as its tooling, to provide a state-of-the-art library.
In this talk, we’ll cover, among other topics:
•How to plan for backward-compatibility
•Why Go generics are not always needed
•Providing flexible and public API
•How useful the empty interface can be
•Using channels sparingly
•Designing a fast and concurrent testing suite for integration tests