Permalink
Browse files

ctxhttp: Deprecate package in favor of upstream version.

The issue golang/go#21358 has been resolved upstream, so there's
no more need to have a temporary fork of the ctxhttp package.

Also backport CL 36673 while here to have the code in sync.
  • Loading branch information...
dmitshur committed Nov 14, 2018
1 parent 9e1955d commit 58262d155ee0c659f3e3963bfccbac0f6a6a1d2b
Showing with 12 additions and 4 deletions.
  1. +11 −4 ctxhttp/ctxhttp.go
  2. +1 −0 ctxhttp/ctxhttp_test.go
@@ -6,10 +6,12 @@
// Package ctxhttp provides helper functions for performing context-aware HTTP requests.
//
// It's a copy of "golang.org/x/net/context/ctxhttp" with pre-1.7 support dropped,
// and "golang.org/x/net/context" import replaced with "context".
// It exists temporarily until "golang.org/x/net/context/ctxhttp" is updated,
// which will happen "in a couple releases" according to https://golang.org/cl/24620.
// It's a copy of golang.org/x/net/context/ctxhttp with Go 1.6 support dropped
// and golang.org/x/net/context import replaced with context from standard library.
// It existed temporarily until golang.org/x/net/context/ctxhttp was updated in the same way,
// which has happenened on 2018-11-13 in https://golang.org/cl/149277.
//
// Deprecated: Use package golang.org/x/net/context/ctxhttp instead. This package will be deleted on 2018-12-01.
package ctxhttp
import (
@@ -20,6 +22,11 @@ import (
"strings"
)
func init() {
println("The github.com/shurcooL/go/ctxhttp package is deprecated, and will be deleted on 2018-12-01. " +
"Use golang.org/x/net/context/ctxhttp package instead.")
}
// Do sends an HTTP request with the provided http.Client and returns
// an HTTP response.
//
@@ -21,6 +21,7 @@ func TestGo17Context(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
io.WriteString(w, "ok")
}))
defer ts.Close()
ctx := context.Background()
resp, err := Get(ctx, http.DefaultClient, ts.URL)
if resp == nil || err != nil {

0 comments on commit 58262d1

Please sign in to comment.