AlgoMaster Logo

Race Detector (-race)

High Priority22 min readUpdated June 6, 2026

Data races are the worst kind of concurrency bug: the program doesn't crash, it just produces wrong answers sometimes. Two goroutines touch the same memory without coordination, one of them writes, and the result depends on which one happened to win that nanosecond. Go ships a tool that finds these bugs at runtime called the race detector, enabled with a single -race flag. This lesson covers what a race is, how the detector works, how to read its reports, and how to wire it into CI so a race in your code never reaches production.

Premium Content

Subscribe to unlock full access to this content and more premium articles.