`time.NewTicker(d)` fires on a channel every `d` interval. Combine with select + a done channel for a clean way to run periodic work that can be cancelled.
Attach data to a context that flows down through your call chain — request IDs, authenticated user, trace spans. Use a private key type to avoid collisions across packages.
`context.Context` propagates deadlines, cancellation, and request-scoped values down a call chain. EVERY blocking / long-running function should take a `ctx context.Context` as its first parameter.
A goroutine that's blocked forever on a channel send/receive leaks — it's never garbage-collected. Always pair channels with `select { case <-ctx.Done(): return }` to give them an exit path.
`golang.org/x/sync/errgroup` runs N goroutines, returns the first error, and cancels the others via a shared context. The right pattern for parallel I/O where any failure should abort the rest.
`anyhow::Result<T>` is `Result<T, anyhow::Error>` — a type-erased error that captures any other error AND adds context via `.context()`. The app-author's pick (use thiserror for libraries).
On SIGINT/SIGTERM, stop accepting new connections but let in-flight requests finish. The `http.Server.Shutdown` method does exactly that — with a deadline.
Go 1.16+ `signal.NotifyContext` returns a context that's canceled on the listed signals. Cleaner than the legacy `signal.Notify(channel)` dance for graceful shutdown.