Skip to content

Instantly share code, notes, and snippets.

@hbd
Created January 22, 2020 06:34
Show Gist options
  • Save hbd/add00d528296a264f409a79ea0bf44e7 to your computer and use it in GitHub Desktop.
Save hbd/add00d528296a264f409a79ea0bf44e7 to your computer and use it in GitHub Desktop.
Writing Clients in Go: Redundancy and the `*iface` Package
package bing
func (c *Client) DriveTime(ctx context.Context, locations ...Location) (float64, error) {
// Call external API.
driveTime, err := c.httpclient.Post(ctx, c.config.Endpoint+"/routing/time", ...)
...
return driveTime, nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment