Menu

1 / 2

Go Race Detector Output: 3 Stack Shapes That Mean Different Things

DEV Community·Gabriel Anhaia·6 months ago
#St6bCgQq
#shape#go#concurrency#testing#race
Reading 0:00
15s threshold

Book: The Complete Guide to Go Programming

Also by me: Thinking in Go (2-book series) — Complete Guide to Go Programming + Hexagonal Architecture in Go

My project: Hermes IDE | GitHub — an IDE for developers who ship with Claude Code and other AI coding tools

Me: xgabriel.com | GitHub

The first time you see WARNING: DATA RACE in your terminal

you scroll. Wall of stack frames, two columns of "Read at" and

"Previous write at", goroutine IDs that mean nothing yet, a

creation stack at the bottom. The output is dense on purpose.

The detector is showing you everything it knows so you can

reconstruct the interleaving that produced the race.

Race reports come in a small number of shapes. Once you have

read a few, they collapse into patterns. This post is about

three: a read/write race on a shared map, a

closure-over-loop-variable race, and a data race carried by an

interface fat-pointer.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.