Curriculum Idioms & ecosystem Context exercise 3 · mcq
Context
Inside a goroutine doing long work, how do you LISTEN for
cancellation from a ctx context.Context parameter?
TypeScript: signal.addEventListener("abort", ...).
Go's idiom uses a channel + select.
TypeScript reference
About this theme
context.Context propagates cancellation, deadlines, and request-scoped values across goroutines and API boundaries. By convention, the first argument of any function that does I/O or starts a goroutine is ctx context.Context. Listening for <-ctx.Done() is how you write cancellable work.