A Beginners Guide to Context
summary
Walks through the Go context API as folded into the standard library in Go 1.7, showing the actual functions: WithCancel, WithDeadline, WithTimeout and WithValue, plus Done, Err and Deadline semantics. Builds a small web search app that queries DuckDuckGo and Giphy concurrently with a hard 2‑second timeout, passes session-rated content via a context value (uses a private key type to avoid collisions), cancels other work when text results arrive, and demos Request.WithContext / context-aware HTTP clients.
AI-written summary · about
chapters (29)
- 0:00Intro
- 0:41Agenda
- 0:54The problem
- 1:34The Context Package
- 2:19Context Overview
- 3:48Context Type
- 4:03Cancel
- 5:50Value
- 7:27Derived Context
- 8:13Background
- 9:07Cancellation
- 9:47Timeout
- 10:18DuckDuckGo
- 11:08Does it actually work
- 11:37Web Server
- 11:59Login
- 12:39Session Package
- 13:09Email Lookup
- 13:26Session Data
- 14:40Home Action
- 15:03Search Action
- 16:47Listen for Results
- 17:50Show Results
- 18:10Search
- 18:22Duck Duck Query
- 19:17After Deadline
- 19:33Get 4 Terms
- 21:07After Deadline Function
- 21:58Context HTTP
related talks
07mHow Should We Access Global Resources?
29mCTX is Key!
24mWhen to Stop Going Down the Rabbit Hole: Taming Context-Sensitivity on the Fly
46mWhy you can't use GO! (away from anti-patterns)
49mExploring domain driven design in Go
55mCharting the uncharted: Discovering and evolving bounded contexts
40mDay 3 Closing Talk: The Legacy of Go
44mHow Do You Structure Your Go Apps?
