17. Short Q&A Prompts (Practice)

Targeted prompts to practice depth, clarity, and trade‑offs under time pressure.

  • When should you use context.WithTimeout vs server timeouts?
  • Explain backpressure with buffered channels.
  • How does sync.Once establish happens‑before?
  • What changed in Go 1.22 loop variable semantics?
  • How do you prevent goroutine leaks in streaming HTTP handlers?
  • When to prefer http.NewServeMux over frameworks?
  • How to tune DB pool settings for spiky traffic?
  • When is sync.Map preferable to map+mutex?
  • How do you design idempotent retries with backoff and jitter?
  • How do you add correlation IDs to logs and traces?