Closures, Defer, and Panic in Go
Understand Go closure capture, deferred evaluation, cleanup lifetimes, and panic recovery with runnable examples and practical guidance for backend code.
Category edition · 10 articles
Go language patterns, concurrency, testing, tooling, and production services.
From the archive
Understand Go closure capture, deferred evaluation, cleanup lifetimes, and panic recovery with runnable examples and practical guidance for backend code.
Learn how Go allocation differs from assignment and initialisation, when new, make, and append need storage, and what B/op and allocs/op actually measure.
Understand Go method sets, value and pointer receivers, interface comparisons, and typed nil through runnable examples and practical API design decisions.
Explore Go struct padding, field order, alignment, and size with runnable examples, plus practical guidance on memory savings, portability, and encoding.
Learn when to use Go maps, how keys and zero values behave, why iteration needs care, and how to handle shared state and concurrent updates safely.
Compare Go strings, bytes, and runes: when to use each, why UTF-8 boundaries matter, and how validation, mutation, and conversion costs affect real applications.
Follow Go code from modules and packages through compilation, linking, and runtime startup, with a runnable experiment showing what happens before main.
Understand Go's pass-by-value semantics, pointer aliasing, shallow copies, and ownership through runnable examples that reveal which mutations reach callers.
Explore Go arrays and slices through runnable examples of backing arrays, length, capacity, append, copying, and the mutations that shared storage makes possible.
A practical framework for timeouts, retries, idempotency, and observability in production Go services.