4 ms·
No context does 2 things : - send signals by exposing a channel - serves as a bag of values (the infamous .Values method ). Context was invented because Go d
by camus2 9y ago
No context does 2 things :
- send signals by exposing a channel
- serves as a bag of values (the infamous .Values method ).
Context was invented because Go developers kept writing leaky servers as they were referencing *http.Request outside an http.Handler (for session management for instance) . If you do that, you need to be able to signal that the request treatment is done or you will have a memory leak.
I guess they added .Values(interface{})interface{} because they could.