context パッケージは、キャンセル信号、デッドライン、およびリクエストスコープの値を API 境界とゴルーチン間で伝達します。これは操作のライフタイムを制御する標準メカニズムです。特に、作業をキャンセルし、関数呼び出しの連鎖全体にタイムアウトを伝播させるためのものです。
解決する主な問題
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.
