This post describes what I feel are best practices when creating a client library for a service. The initial setup is that you’re writing a library with an API to talk to a RESTful service over HTTPS, and all the library needs to do is return JSON unmarshalled objects. I’ll use some examples from a client I wrote to talk to Smite’s API. Directly use the struct Link to heading While constructor functions are sometimes needed for Go libraries, it’s strongly preferred to support users di...