# WARNING: DATA RACE
Write at 0x00c000... by goroutine 7
Previous write at 0x00c000... by goroutine 8

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

## Root Cause

Two goroutines access the same memory location without synchronization, with at least one write, detected by the race detector when running with -race.

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   var mu sync.Mutex
mu.Lock()
counter++
mu.Unlock()
// or
atomic.AddInt64(&counter, 1)
   ```
2. **** (92% success)
   ```
   results := make(chan int, len(items))
for _, it := range items {
    it := it
    go func(v int) { results <- compute(v) }(it)
}
   ```

## Dead Ends

- **** — The race is real; disabling detection does not fix corruption, which surfaces later as random crashes. (95% fail)
- **** — Sleep reduces the window but does not eliminate the race; the detector still reports it. (90% fail)
