Go theorytheory 0/50 · 0%
Concurrency · medium

25. Context

Deadlines, cancellation and request scope.

context.Context carries cancellation signals, deadlines and request-scoped values through call chains. Pass it as the first parameter, honour ctx.Done() in loops and blocking calls, and derive child contexts with WithTimeout or WithCancel.

Check your understanding

  1. 1. Context should be passed as…

  2. 2. Which channel reports cancellation?