# WARNING: DATA RACE

- **ID:** `go/race-detector-found-data-race`
- **Domain:** go
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The race detector (go test -race / go run -race) observed two goroutines accessing the same memory location concurrently, at least one being a write, without synchronization.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.18 | active | — | — |
| 1.20 | active | — | — |
| 1.21 | active | — | — |
| 1.22 | active | — | — |

## Workarounds

1. **** (92% success)
   ```
   Introduce sync.Mutex or sync/atomic around the shared variable; ensure happens-before via channel send/receive.
   ```
2. **** (88% success)
   ```
   Pass data by value into goroutines or use immutable snapshots; run go test -race in CI to prevent regressions.
   ```

## Dead Ends

- **** — The race still corrupts data in production; hiding it makes failures nondeterministic and worse. (95% fail)
- **** — Sleeps reduce detection probability but do not establish a happens-before relationship. (90% fail)
