-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
x/net/context/ctxhttp: replace "golang.org/x/net/context" with "context" (drop Go 1.6 and older support) #21358
Comments
An additional thought on this. I'm not sure what the plans of But if something does happen to it, it might be weird to have package So an alternative solution might be to copy the Go 1.7+ version of |
Another thought. After seeing #19612 and looking at the code more closely, I can see how the 1.7+ implementation is indeed very trivial and perhaps it may no longer be needed. Meaning the package can be deprecated alongside with The only part that's somewhat non-trivial and would be annoying to keep doing at every call site is this: // If we got an error, and the context has been canceled,
// the context's error is probably more useful.
if err != nil {
select {
case <-ctx.Done():
err = ctx.Err()
default:
}
} But it is optional... Hmm. |
Given that x/net/context is barely more than a type alias now, there's no longer much to gain by forcing its deprecation. So, maybe just keep everything as-is for some time? |
@campoy pointed out that the package is still helpful if you want to do |
@bradfitz, we've been removing support for Go 1.6 and replacing I propose we just just drop Go 1.6 support, start using DiscussionMy understanding is that modern I see a few options:
I think we should go with option 1 because it's simplest. |
Let's do (1). I started work on a new HTTP client API (your option 3), btw. But I'm fine with some cleanup meanwhile. |
Woohoo! CL incoming. |
Change https://golang.org/cl/149277 mentions this issue: |
The issue golang/go#21358 has been resolved upstream, so there's no more need to use a temporary fork of the ctxhttp package. Fixes #2.
The issue golang/go#21358 has been resolved upstream, so there's no more need to use a temporary fork of the ctxhttp package.
The issue golang/go#21358 has been resolved upstream, so there's no more need to use a temporary fork of the ctxhttp package.
The issue golang/go#21358 has been resolved upstream, so there's no more need to use a temporary fork of the ctxhttp package. Remove the forked ctxhttp package from package listing. It's about to be deprecated, so no point in showing it.
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.
The issue golang/go#21358 has been resolved upstream, so there's no more need to use a temporary fork of the ctxhttp package.
The
golang.org/x/net/context/ctxhttp
package currently has 2 different implementations for Go 1.7+ and pre-1.7. The former is much simpler, becausenet/http
has support for contexts and cancellation built in as of Go 1.7. However both versions usegolang.org/x/net/context
package, not the newcontext
in Go 1.7+ standard library.When the Go 1.7+ support was added to
ctxhttp
package in CL 24620, @bradfitz wanted to avoid changing the signature and said in this comment:Now that Go 1.9 final is almost out, it has been a couple releases. Is it a good time to delete the old way, and allow the package to import
context
instead ofgolang.org/x/net/context
?To avoid importing
golang.org/x/net/context
unnecessarily, I made a 1.7+ copy ofctxhttp
atgithub.com/shurcooL/go/ctxhttp
, but it's an extra dependency which may be problematic for people, e.g., see shurcooL/graphql#2. /cc @gmlewisThe text was updated successfully, but these errors were encountered: