-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
proposal: x/net/context: move to the standard library #13021
Comments
A related proposal is to remove the Deadline method from the Context interface and so remove its dependence on the "time" package. This would permit the Context interface to be used in packages that cannot depend on "time". Context's deadline support would be implemented using a Context value. Callers would access the deadline with a function in a separate package deadline as |
Please write this up as a proposal doc. |
Please write a proposal doc. Be sure to mention
FWIW I don't see any compelling reason to try to eliminate references to package time from the context API. Even if Context were to go into io, it seems okay to me at first glance to make io depend on time. Thanks. |
CL https://golang.org/cl/21810 mentions this issue. |
Updates #13021 Updates #15224 Change-Id: Ia3cd608bb887fcfd8d81b035fa57bd5eb8edf09b Reviewed-on: https://go-review.googlesource.com/21810 Reviewed-by: Andrew Gerrand <[email protected]> Run-TryBot: Brad Fitzpatrick <[email protected]> Reviewed-by: Emmanuel Odeke <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
CL https://golang.org/cl/22101 mentions this issue. |
For #12580 (http.Transport tracing/analytics) Updates #13021 Change-Id: I126e494a7bd872e42c388ecb58499ecbf0f014cc Reviewed-on: https://go-review.googlesource.com/22101 Run-TryBot: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Reviewed-by: Mikio Hara <[email protected]>
CL https://golang.org/cl/22124 mentions this issue. |
This simply connects the contexts, pushing them down the call stack. Future CLs will utilize them. For #12580 (http.Transport tracing/analytics) Updates #13021 Change-Id: I5b2074d6eb1e87d79a767fc0609c84e7928d1a16 Reviewed-on: https://go-review.googlesource.com/22124 Reviewed-by: Ian Lance Taylor <[email protected]> Run-TryBot: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
This got done. Closing. |
The context package provides a standard interface for passing request-scoped values, deadlines, and cancelation information across package boundaries. Examples of request-scoped values include authentication information, golang.org/x/net/trace.Traces, and Dapper-like distributed tracing IDs. Context is widely used: godoc.org lists 1500+ imports. Context is a critical element in RPC systems like Go-kit's Endpoint interface and gRPC Go.
We (@Sajmani and @bradfitz) would like to incorporate Context into standard library packages (see list below). Standard library packages cannot depend on external packages, so we propose moving the context package into the standard library as package "context".
One complication with moving this package is that interfaces that currently mention golang.org/x/net/context.Context will not be satisfied by implementations that use context.Context. For example, gRPC service implementations will fail to compile if we change the Go protocol compiler to use context.Context. We will need to provide some way to manage this transition.
Potential uses of Context in the standard library:
The text was updated successfully, but these errors were encountered: