All languages

Go for DevOps

You're viewing a free preview. Sign in free to read every script.

Why this exists Real programs need to stop things: a request that took too long, a user who pressed Ctrl+C, a batch where one part already failed. Go's answer is context.Context, passed as the first argument through…

Context: Timeouts, Cancellation and Passing Deadlines Down

How context.Context carries cancellation and deadlines through a program: WithTimeout, WithCancel, checking ctx.Done in your own functions, propagating context into HTTP calls and commands, and the errgroup pattern for cancelling sibling work on the first failure.

Sign in free to read this script, along with the rest of the library.

Sign in free