From 83030a1ac0f3d629c646d07eea539f36997671b0 Mon Sep 17 00:00:00 2001 From: Jackson Owens Date: Thu, 4 May 2017 00:46:34 -0400 Subject: [PATCH] Use context.Background over oauth2.NoContext The oauth2.NoContext variable was deprecated in golang/oauth2@c10ba270aa0bf8b8c1c986e103859c67a9103061. --- README.md | 2 +- util/droplet_test.go | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4d5cdf8..44b2e4d 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ func (t *TokenSource) Token() (*oauth2.Token, error) { tokenSource := &TokenSource{ AccessToken: pat, } -oauthClient := oauth2.NewClient(oauth2.NoContext, tokenSource) +oauthClient := oauth2.NewClient(context.Background(), tokenSource) client := godo.NewClient(oauthClient) ``` diff --git a/util/droplet_test.go b/util/droplet_test.go index c34dd61..9dad90a 100644 --- a/util/droplet_test.go +++ b/util/droplet_test.go @@ -13,14 +13,15 @@ func ExampleWaitForActive() { token := &oauth2.Token{AccessToken: pat} t := oauth2.StaticTokenSource(token) - oauthClient := oauth2.NewClient(oauth2.NoContext, t) + ctx := context.TODO() + oauthClient := oauth2.NewClient(ctx, t) client := godo.NewClient(oauthClient) // create your droplet and retrieve the create action uri uri := "https://api.digitalocean.com/v2/actions/xxxxxxxx" // block until until the action is complete - err := WaitForActive(context.TODO(), client, uri) + err := WaitForActive(ctx, client, uri) if err != nil { panic(err) }