What canceled my go context

last updated: Jun 10, 2026

https://rednafi.com/go/context-cancellation-cause/

Excellent article walking through one of the finer points of context usage: figuring out what cancelled your context.

Gives examples of how to make sure you can always figure it out.


brandur starts with the same context.WithTimeoutCause, but gives a different recipe, describing a function timeoututil.AttributedTimeout that takes a closure and handles context deadlines from within that closure

↑ up