context package అనేది cancellation signals, deadlines, మరియు request-scoped values లను API boundaries మరియు goroutines అంతటా రవాణా చేస్తుంది. ఇది operations యొక్క lifetime నిర్వహించడానికి — ప్రత్యేకించి work యొక్క cancellation మరియు timeouts లను function calls యొక్క chain ద్వారా ప్రచారం చేయడానికి ప్రామాణిక mechanism.
ఇది పరిష్కరించే core problem
A request starts work across many goroutines/functions (DB query, API call, etc.).
If the client disconnects or a timeout hits, you want to CANCEL all that work
so goroutines don't keep running uselessly (wasting resources / leaking).
→ context propagates the "stop now" signal down the entire call chain.
