Skip to content
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

Switch to stdlib context package (go1.8+) #514

Merged
merged 2 commits into from
Apr 23, 2017

Conversation

eticzon
Copy link
Contributor

@eticzon eticzon commented Apr 21, 2017

Unfortunately the ctxhttp package is still under the "x" directory. So we're still left with the "golang.org/x/net/context/ctxhttp" import path for client.go and ping.go. Hopefully this would be merged to stdlib in the near future.

This should address issue #425.

@eticzon
Copy link
Contributor Author

eticzon commented Apr 23, 2017

Unfortunately the ctxhttp package is still under the "x" directory. So we're still left with the "golang.org/x/net/context/ctxhttp" import path for client.go and ping.go. Hopefully this would be merged to stdlib in the near future.

As @olivere has pointed, out the http.Client is now context-aware and http.Request has the handy WithContext(...) method.

On both client.go and ping.go uses ofctxhttp have been removed.

@olivere
Copy link
Owner

olivere commented Apr 23, 2017

Awesome. Thank you very much.

I'm still undecided if we should do this breaking change in the middle of the 5.0 release cycle. What do you think?

@olivere
Copy link
Owner

olivere commented Apr 23, 2017

Hmm. I checked three of my applications and they all compile without any problem with your changes. So I think there might only be a problem for those poor people still using libraries like google.golang.org/grpc who (for whatever reason) don't like to switch to "context".

@olivere olivere merged commit 504b3df into olivere:release-branch.v5 Apr 23, 2017
@eticzon
Copy link
Contributor Author

eticzon commented Apr 23, 2017

Thanks for merging. 👍

IMHO since context has been in the stdlib for several releases now it maybe best to start doing this now (rather than later).

I guess if for those projects using grpc, if and when they raise an issue, we could refer them back to this PR and they can decide on how best to tackle their dependency problem.

From that issue discussion, there seems to be a strong push to start doing the same migration from from golang.org/x/net/context to the stdlib version, so hopefully it won't be a problem for them soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants