go/race

Race Detection

Detect race conditions

go
race
concurrency

Command

go run -race main.go

Explanation

Enable race condition detection to find data races in concurrent Go programs.

Examples

Run with race detection

go run -race main.go

Test with race detection

go test -race ./...

Build with race detection

go build -race