All of github.Client's service fields point to objects with identical underlying struct types. Currently they're each separately heap allocated, but they could be made to reuse the same memory. For example, add a field to github.Client:
self struct{ client *Client }
And then change github.NewClient to initialize the service fields as so:
c.self.client = c
c.Activity = (*ActivityService)(&c.self)
c.Authorizations = (*AuthorizationsService)(&c.self)
c.Gists = (*GistsService)(&c.self)
...
Just a random observation while looking at the API/implementation. Feel free to close if you don't think this optimization is worthwhile.
All of github.Client's service fields point to objects with identical underlying struct types. Currently they're each separately heap allocated, but they could be made to reuse the same memory. For example, add a field to github.Client:
And then change github.NewClient to initialize the service fields as so:
Just a random observation while looking at the API/implementation. Feel free to close if you don't think this optimization is worthwhile.