July 2017
Beginner to intermediate
358 pages
10h 54m
English
The WithValue method returns a copy of the parent Context in which the val value is associated with the key. The Context values are perfect to be used for request-scoped data:
func WithValue(parent Context, key interface{}, val interface{}) Context
Why not attempt to modify example 1.7 to implement a request scoped context. The key could be in the previous sentence; every request needs its own context.
Read now
Unlock full access