From 48e6317de1cc64edc04afa080d8e284c83160fa8 Mon Sep 17 00:00:00 2001 From: Alex Suraci Date: Sat, 30 Jan 2016 11:46:08 -0800 Subject: [PATCH] switch to golang.org/x/oauth2 fixes #22 --- github.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/github.go b/github.go index a6fc12e..b3ac1d6 100644 --- a/github.go +++ b/github.go @@ -6,7 +6,7 @@ import ( "net/url" "os" - "code.google.com/p/goauth2/oauth" + "golang.org/x/oauth2" "github.com/google/go-github/github" ) @@ -37,18 +37,16 @@ type GitHubClient struct { } func NewGitHubClient(source Source) (*GitHubClient, error) { - transport := &oauth.Transport{ - Token: &oauth.Token{ - AccessToken: source.AccessToken, - }, - } - var client *github.Client - if transport.Token.AccessToken == "" { + if source.AccessToken == "" { client = github.NewClient(nil) } else { - client = github.NewClient(transport.Client()) + ts := oauth2.StaticTokenSource(&oauth2.Token{ + AccessToken: source.AccessToken, + }) + + client = github.NewClient(oauth2.NewClient(oauth2.NoContext, ts)) } if source.GitHubAPIURL != "" {