Cancellation belongs to the whole request tree.
A request may launch multiple goroutines and downstream calls. Go context carries cancellation, deadlines, and request-scoped values across those boundaries. Derived contexts form a tree: cancelling a parent tells its descendants to stop. Passing this context explicitly helps related work respond to the lifetime of the request.
The Go Blog · Jul 29, 2014
Why it matters
Helpful when a network timeout should also stop downstream calls and background computation tied to that request.
More context
Make the caller’s deadline available where blocking work happens. A context communicates cancellation; the receiving code still needs to observe it or call APIs that do. Avoid putting unrelated configuration into request-scoped values.
Keep in mind
Cancellation is cooperative. Passing a context does not forcibly terminate arbitrary code or reverse completed side effects.
Original read