typeover
curriculum

Curriculum Idioms & ecosystem Context exercise 1 · mcq

Context

Pick the line that creates a fresh root context.Context — the starting point for any context chain in a program. TypeScript: no direct analog. The closest pattern is an AbortController (which most fetch-based code now uses).

TypeScript reference
Pick the idiomatic Go translation

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.