Curriculum Idioms & ecosystem Context
Context
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.
Exercises
9 ready
01
pick one
Pick the line that creates a fresh root context.Context —
02
pick one
Pick the line that creates a CANCELLABLE child context from
03
pick one
Inside a goroutine doing long work, how do you LISTEN for
04
fill blanks
Type the method on context.Context that returns the
05
fill blanks
After a context is cancelled, this method returns a
06
type one line
Type the derivation line that creates a cancellable child
07
type one line
Type the select case line that listens for context
08
write a program
Build the canonical context.WithTimeout shape — a
09
write a program
Theme 7.3 capstone — context propagation across goroutines.