Skip to content

all: use stdlib context instead of x/net/context #339

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion clientcredentials/clientcredentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
2 changes: 1 addition & 1 deletion google/appengine.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
package google

import (
"context"
"sort"
"strings"
"sync"
"time"

"golang.org/x/net/context"
"golang.org/x/oauth2"
)

Expand Down
2 changes: 1 addition & 1 deletion google/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package google

import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
Expand All @@ -14,7 +15,6 @@ import (
"runtime"

"cloud.google.com/go/compute/metadata"
"golang.org/x/net/context"
"golang.org/x/oauth2"
)

Expand Down
2 changes: 1 addition & 1 deletion google/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion google/go19.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
package google

import (
"golang.org/x/net/context"
"context"

"golang.org/x/oauth2"
)

Expand Down
2 changes: 1 addition & 1 deletion google/google.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
package google

import (
"context"
"encoding/json"
"errors"
"fmt"
"strings"
"time"

"cloud.google.com/go/compute/metadata"
"golang.org/x/net/context"
"golang.org/x/oauth2"
"golang.org/x/oauth2/jwt"
)
Expand Down
3 changes: 2 additions & 1 deletion google/not_go19.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
package google

import (
"golang.org/x/net/context"
"context"

"golang.org/x/oauth2"
)

Expand Down
2 changes: 1 addition & 1 deletion google/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package google

import (
"bufio"
"context"
"encoding/json"
"errors"
"fmt"
Expand All @@ -18,7 +19,6 @@ import (
"strings"
"time"

"golang.org/x/net/context"
"golang.org/x/oauth2"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package internal

import (
"context"
"encoding/json"
"errors"
"fmt"
Expand All @@ -17,7 +18,6 @@ import (
"strings"
"time"

"golang.org/x/net/context"
"golang.org/x/net/context/ctxhttp"
)

Expand Down
3 changes: 1 addition & 2 deletions internal/token_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 1 addition & 2 deletions internal/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion jwt/jwt.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
package jwt

import (
"context"
"encoding/json"
"fmt"
"io"
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion oauth2.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
3 changes: 1 addition & 2 deletions oauth2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package oauth2

import (
"context"
"errors"
"fmt"
"io/ioutil"
Expand All @@ -13,8 +14,6 @@ import (
"net/url"
"testing"
"time"

"golang.org/x/net/context"
)

type mockTransport struct {
Expand Down
2 changes: 1 addition & 1 deletion token.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
package oauth2

import (
"context"
"fmt"
"net/http"
"net/url"
"strconv"
"strings"
"time"

"golang.org/x/net/context"
"golang.org/x/oauth2/internal"
)

Expand Down