summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine GIRARD <sapk@sapk.fr>2018-11-01 15:53:36 +0000
committerBrad Fitzpatrick <bradfitz@golang.org>2018-11-01 16:01:52 +0000
commitc453e0c757598fd055e170a3a359263c91e13153 (patch)
treeb9f3c688dd42bc1a696991642ba2d2259755667c
parent5a69e67f3fa6ce11b512c271912d08ac74da7c7f (diff)
downloadgolang-x-oauth2-c453e0c757598fd055e170a3a359263c91e13153.tar.gz
all: use stdlib context instead of x/net/context
This PR replaces use of `x/net/context` with the standard `context` It has been nearly 6 months since https://github.com/golang/oauth2/issues/246#issuecomment-387601277 so I made this PR so it will be ready to merge when needed (and if possible). Fixes #246 Change-Id: Id2c316fcb27de0fb9163ceb4e8669b04cb39a987 GitHub-Last-Rev: 5b36321dccef8da97d67188fe307d1c135793ad6 GitHub-Pull-Request: golang/oauth2#339 Reviewed-on: https://go-review.googlesource.com/c/145202 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-rw-r--r--README.md6
-rw-r--r--clientcredentials/clientcredentials.go2
-rw-r--r--google/appengine.go2
-rw-r--r--google/default.go2
-rw-r--r--google/example_test.go2
-rw-r--r--google/go19.go3
-rw-r--r--google/google.go2
-rw-r--r--google/not_go19.go3
-rw-r--r--google/sdk.go2
-rw-r--r--internal/token.go2
-rw-r--r--internal/token_test.go3
-rw-r--r--internal/transport.go3
-rw-r--r--jwt/jwt.go2
-rw-r--r--oauth2.go2
-rw-r--r--oauth2_test.go3
-rw-r--r--token.go2
16 files changed, 21 insertions, 20 deletions
diff --git a/README.md b/README.md
index eb8dcee..94ffd73 100644
--- a/README.md
+++ b/README.md
@@ -24,7 +24,9 @@ See godoc for further documentation and examples.
In change 96e89be (March 2015), we removed the `oauth2.Context2` type in favor
of the [`context.Context`](https://golang.org/x/net/context#Context) type from
-the `golang.org/x/net/context` package
+the `golang.org/x/net/context` package. Later replaced by the standard `context` package
+of the [`context.Context`](https://golang.org/pkg/context#Context) type.
+
This means it's no longer possible to use the "Classic App Engine"
`appengine.Context` type with the `oauth2` package. (You're using
@@ -44,7 +46,7 @@ with the `oauth2` package.
```go
import (
- "golang.org/x/net/context"
+ "context"
"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
newappengine "google.golang.org/appengine"
diff --git a/clientcredentials/clientcredentials.go b/clientcredentials/clientcredentials.go
index c4e840d..ba57e4c 100644
--- a/clientcredentials/clientcredentials.go
+++ b/clientcredentials/clientcredentials.go
@@ -14,12 +14,12 @@
package clientcredentials // import "golang.org/x/oauth2/clientcredentials"
import (
+ "context"
"fmt"
"net/http"
"net/url"
"strings"
- "golang.org/x/net/context"
"golang.org/x/oauth2"
"golang.org/x/oauth2/internal"
)
diff --git a/google/appengine.go b/google/appengine.go
index fb46b5c..feb1157 100644
--- a/google/appengine.go
+++ b/google/appengine.go
@@ -5,9 +5,9 @@
package google
import (
+ "context"
"time"
- "golang.org/x/net/context"
"golang.org/x/oauth2"
)
diff --git a/google/default.go b/google/default.go
index 5655860..96f9a36 100644
--- a/google/default.go
+++ b/google/default.go
@@ -5,6 +5,7 @@
package google
import (
+ "context"
"encoding/json"
"fmt"
"io/ioutil"
@@ -14,7 +15,6 @@ import (
"runtime"
"cloud.google.com/go/compute/metadata"
- "golang.org/x/net/context"
"golang.org/x/oauth2"
)
diff --git a/google/example_test.go b/google/example_test.go
index 643f507..d9c5a10 100644
--- a/google/example_test.go
+++ b/google/example_test.go
@@ -5,12 +5,12 @@
package google_test
import (
+ "context"
"fmt"
"io/ioutil"
"log"
"net/http"
- "golang.org/x/net/context"
"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
"golang.org/x/oauth2/jwt"
diff --git a/google/go19.go b/google/go19.go
index c12c820..23fe4d8 100644
--- a/google/go19.go
+++ b/google/go19.go
@@ -7,7 +7,8 @@
package google
import (
- "golang.org/x/net/context"
+ "context"
+
"golang.org/x/oauth2"
)
diff --git a/google/google.go b/google/google.go
index f7481fb..ca7d208 100644
--- a/google/google.go
+++ b/google/google.go
@@ -5,6 +5,7 @@
package google
import (
+ "context"
"encoding/json"
"errors"
"fmt"
@@ -12,7 +13,6 @@ import (
"time"
"cloud.google.com/go/compute/metadata"
- "golang.org/x/net/context"
"golang.org/x/oauth2"
"golang.org/x/oauth2/jwt"
)
diff --git a/google/not_go19.go b/google/not_go19.go
index b64a5b4..f942b32 100644
--- a/google/not_go19.go
+++ b/google/not_go19.go
@@ -7,7 +7,8 @@
package google
import (
- "golang.org/x/net/context"
+ "context"
+
"golang.org/x/oauth2"
)
diff --git a/google/sdk.go b/google/sdk.go
index b9660ca..456224b 100644
--- a/google/sdk.go
+++ b/google/sdk.go
@@ -6,6 +6,7 @@ package google
import (
"bufio"
+ "context"
"encoding/json"
"errors"
"fmt"
@@ -18,7 +19,6 @@ import (
"strings"
"time"
- "golang.org/x/net/context"
"golang.org/x/oauth2"
)
diff --git a/internal/token.go b/internal/token.go
index 53259a4..5ab17b9 100644
--- a/internal/token.go
+++ b/internal/token.go
@@ -5,6 +5,7 @@
package internal
import (
+ "context"
"encoding/json"
"errors"
"fmt"
@@ -17,7 +18,6 @@ import (
"strings"
"time"
- "golang.org/x/net/context"
"golang.org/x/net/context/ctxhttp"
)
diff --git a/internal/token_test.go b/internal/token_test.go
index 7b52e51..d1da8bb 100644
--- a/internal/token_test.go
+++ b/internal/token_test.go
@@ -5,14 +5,13 @@
package internal
import (
+ "context"
"fmt"
"io"
"net/http"
"net/http/httptest"
"net/url"
"testing"
-
- "golang.org/x/net/context"
)
func TestRegisterBrokenAuthHeaderProvider(t *testing.T) {
diff --git a/internal/transport.go b/internal/transport.go
index d16f9ae..572074a 100644
--- a/internal/transport.go
+++ b/internal/transport.go
@@ -5,9 +5,8 @@
package internal
import (
+ "context"
"net/http"
-
- "golang.org/x/net/context"
)
// HTTPClient is the context key to use with golang.org/x/net/context's
diff --git a/jwt/jwt.go b/jwt/jwt.go
index e08f315..0783a94 100644
--- a/jwt/jwt.go
+++ b/jwt/jwt.go
@@ -9,6 +9,7 @@
package jwt
import (
+ "context"
"encoding/json"
"fmt"
"io"
@@ -18,7 +19,6 @@ import (
"strings"
"time"
- "golang.org/x/net/context"
"golang.org/x/oauth2"
"golang.org/x/oauth2/internal"
"golang.org/x/oauth2/jws"
diff --git a/oauth2.go b/oauth2.go
index 16775d0..0a3c1e1 100644
--- a/oauth2.go
+++ b/oauth2.go
@@ -10,13 +10,13 @@ package oauth2 // import "golang.org/x/oauth2"
import (
"bytes"
+ "context"
"errors"
"net/http"
"net/url"
"strings"
"sync"
- "golang.org/x/net/context"
"golang.org/x/oauth2/internal"
)
diff --git a/oauth2_test.go b/oauth2_test.go
index ef12ebc..19aaf6b 100644
--- a/oauth2_test.go
+++ b/oauth2_test.go
@@ -5,6 +5,7 @@
package oauth2
import (
+ "context"
"errors"
"fmt"
"io/ioutil"
@@ -13,8 +14,6 @@ import (
"net/url"
"testing"
"time"
-
- "golang.org/x/net/context"
)
type mockTransport struct {
diff --git a/token.go b/token.go
index 34db8cd..9be1ae5 100644
--- a/token.go
+++ b/token.go
@@ -5,6 +5,7 @@
package oauth2
import (
+ "context"
"fmt"
"net/http"
"net/url"
@@ -12,7 +13,6 @@ import (
"strings"
"time"
- "golang.org/x/net/context"
"golang.org/x/oauth2/internal"
)