Go for Infrastructure
Race detector
Go’s race detector reports certain unsynchronized accesses in code paths exercised by a run.
What you will be able to do
- Explain the example and its limits
- Choose a next check for the named failure
What is in the lesson
- A real situation where this goes wrong
- How it works, step by step
- A command to try yourself
- How it fails in production, and how to tell
- Three quiz questions with explanations
Read this lessonFree. No account needed.
More in Go for Infrastructure
- Mutex and RWMutexBeginner · 4 min
A mutex coordinates access to shared state; an RWMutex permits multiple readers or one writer.
- Atomic operationsBeginner · 4 min
sync/atomic performs a read-modify-write on one value as a single indivisible operation.
- Worker poolsBeginner · 4 min
A worker pool bounds concurrency with a fixed number of goroutines reading jobs from one channel.
- Bounded concurrencyBeginner · 4 min
Bounded concurrency limits how many operations are active while a separate queue holds waiting work.
- Backpressure in GoBeginner · 4 min
Explain backpressure in Go as a bounded channel or semaphore that makes fast producers wait, so queued work cannot grow memory without limit during a traffic spike.
- HTTP server timeoutsBeginner · 4 min
Explain what each net/http server timeout limits, and set them so slow or stalled clients cannot hold connections and goroutines open indefinitely on a public API.