Skip to content

Commit 5f6b76b

Browse files
committed
google: remove legacy App Engine context stuff
Fixes #276 Change-Id: I3f2bed7201f2e6bb58913f3fae2e64287b9a66d5 Reviewed-on: https://go-review.googlesource.com/c/161959 Reviewed-by: Ross Light <light@google.com> Reviewed-by: Jean de Klerk <deklerk@google.com> Reviewed-by: Chris Broadfoot <cbro@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
1 parent 80673b4 commit 5f6b76b

File tree

2 files changed

+0
-67
lines changed

2 files changed

+0
-67
lines changed

README.md

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -19,57 +19,6 @@ See godoc for further documentation and examples.
1919
* [godoc.org/golang.org/x/oauth2](http://godoc.org/golang.org/x/oauth2)
2020
* [godoc.org/golang.org/x/oauth2/google](http://godoc.org/golang.org/x/oauth2/google)
2121

22-
23-
## App Engine
24-
25-
In change 96e89be (March 2015), we removed the `oauth2.Context2` type in favor
26-
of the [`context.Context`](https://golang.org/x/net/context#Context) type from
27-
the `golang.org/x/net/context` package. Later replaced by the standard `context` package
28-
of the [`context.Context`](https://golang.org/pkg/context#Context) type.
29-
30-
31-
This means it's no longer possible to use the "Classic App Engine"
32-
`appengine.Context` type with the `oauth2` package. (You're using
33-
Classic App Engine if you import the package `"appengine"`.)
34-
35-
To work around this, you may use the new `"google.golang.org/appengine"`
36-
package. This package has almost the same API as the `"appengine"` package,
37-
but it can be fetched with `go get` and used on "Managed VMs" and well as
38-
Classic App Engine.
39-
40-
See the [new `appengine` package's readme](https://github.com/golang/appengine#updating-a-go-app-engine-app)
41-
for information on updating your app.
42-
43-
If you don't want to update your entire app to use the new App Engine packages,
44-
you may use both sets of packages in parallel, using only the new packages
45-
with the `oauth2` package.
46-
47-
```go
48-
import (
49-
"context"
50-
"golang.org/x/oauth2"
51-
"golang.org/x/oauth2/google"
52-
newappengine "google.golang.org/appengine"
53-
newurlfetch "google.golang.org/appengine/urlfetch"
54-
55-
"appengine"
56-
)
57-
58-
func handler(w http.ResponseWriter, r *http.Request) {
59-
var c appengine.Context = appengine.NewContext(r)
60-
c.Infof("Logging a message with the old package")
61-
62-
var ctx context.Context = newappengine.NewContext(r)
63-
client := &http.Client{
64-
Transport: &oauth2.Transport{
65-
Source: google.AppEngineTokenSource(ctx, "scope"),
66-
Base: &newurlfetch.Transport{Context: ctx},
67-
},
68-
}
69-
client.Get("...")
70-
}
71-
```
72-
7322
## Policy for new packages
7423

7524
We no longer accept new provider-specific packages in this repo. For

google/example_test.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ import (
1414
"golang.org/x/oauth2"
1515
"golang.org/x/oauth2/google"
1616
"golang.org/x/oauth2/jwt"
17-
"google.golang.org/appengine"
18-
"google.golang.org/appengine/urlfetch"
1917
)
2018

2119
func ExampleDefaultClient() {
@@ -122,20 +120,6 @@ func Example_serviceAccount() {
122120
client.Get("...")
123121
}
124122

125-
func ExampleAppEngineTokenSource() {
126-
var req *http.Request // from the ServeHTTP handler
127-
ctx := appengine.NewContext(req)
128-
client := &http.Client{
129-
Transport: &oauth2.Transport{
130-
Source: google.AppEngineTokenSource(ctx, "https://www.googleapis.com/auth/bigquery"),
131-
Base: &urlfetch.Transport{
132-
Context: ctx,
133-
},
134-
},
135-
}
136-
client.Get("...")
137-
}
138-
139123
func ExampleComputeTokenSource() {
140124
client := &http.Client{
141125
Transport: &oauth2.Transport{

0 commit comments

Comments
 (0)