From e1575cffe026cd6733e96b510efce535e91c3d8f Mon Sep 17 00:00:00 2001 From: Ben Tranter Date: Mon, 16 Mar 2020 11:30:42 -0400 Subject: [PATCH] Expand documentation for NewClient Also adds a reference to the godoc for the (now old) NewClient method. --- README.md | 2 ++ godo.go | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e1019f1..cadeb69 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,8 @@ func main() { } ``` +If you need to provide a `context.Context` to your new client, you should use [`godo.NewClient`](https://godoc.org/github.com/digitalocean/godo#NewClient) to manually construct a client instead. + ## Examples diff --git a/godo.go b/godo.go index 58a1b22..f225e29 100644 --- a/godo.go +++ b/godo.go @@ -169,7 +169,12 @@ func NewFromToken(token string) *Client { return NewClient(oauth2.NewClient(ctx, ts)) } -// NewClient returns a new DigitalOcean API client. +// NewClient returns a new DigitalOcean API client, using the given +// http.Client to perform all requests. +// +// Users who wish to pass their own http.Client should use this method. If +// you're in need of further customization, the godo.New method allows more +// options, such as setting a custom URL or a custom user agent string. func NewClient(httpClient *http.Client) *Client { if httpClient == nil { httpClient = http.DefaultClient