Menu

1 / 2

Running go test -race in Production: Sampling Strategies That Don't Kill Throughput

DEV Community·Gabriel Anhaia·6 months ago
#8dltmoI6
#strategy#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

A team I know had a Go service that passed go test -race

on every PR for two years. Coverage was good. The CI step was

green every Friday. Then a customer reported corrupted JSON in a

small fraction of responses. Not enough to alert. Enough to

break a downstream pipeline that was strict about field types.

The race was in a handler that built a response by writing into a

shared *bytes.Buffer from two goroutines. The unit tests never

hit the path under enough load to flip the bits. The integration

tests did not run with -race . CI ran with -race but at a

fraction of production throughput — the scenario the Go docs

warn about.…

Continue reading — create a free account

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