This issue is intended to cover ideas about updating the context package for Go 2.
- The current context package leads to stuttering in declarations:
ctx context.Context.
- The current
Context.WithValue function accepts values of any types, which is easy to misuse by passing, say, a string rather than a value of some package-local type.
- The name
Context is confusing to some people, since the main use of contexts is cancelation of goroutines.
- Context values are passed everywhere explicitly, which troubles some people. Some explicitness is clearly good, but can we make it simpler?
See also #24050 and #20280.
This issue is intended to cover ideas about updating the context package for Go 2.
ctx context.Context.Context.WithValuefunction accepts values of any types, which is easy to misuse by passing, say, a string rather than a value of some package-local type.Contextis confusing to some people, since the main use of contexts is cancelation of goroutines.See also #24050 and #20280.