17. Short Q&A Prompts (Practice)
Targeted prompts to practice depth, clarity, and trade‑offs under time pressure.
- When should you use
context.WithTimeoutvs server timeouts? - Explain backpressure with buffered channels.
- How does
sync.Onceestablish 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.NewServeMuxover frameworks? - How to tune DB pool settings for spiky traffic?
- When is
sync.Mappreferable tomap+mutex? - How do you design idempotent retries with backoff and jitter?
- How do you add correlation IDs to logs and traces?