# WARNING: DATA RACE
Write at 0x00c0000b4010 by goroutine 7:

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

## Root Cause

Two goroutines access the same memory location concurrently, at least one is a write, and no synchronization orders them. Detected only when built with -race; the program otherwise has undefined behavior.

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   Protect the shared variable with a mutex:

var mu sync.Mutex
mu.Lock()
counter++
mu.Unlock()
   ```
2. **** (92% success)
   ```
   Use atomic operations for simple counters:

var counter int64
atomic.AddInt64(&counter, 1)
_ = atomic.LoadInt64(&counter)
   ```

## Dead Ends

- **** — Hiding the report does not fix the race; the bug persists and manifests as corrupted data or crashes in production. (95% fail)
- **** — Sleep reduces the probability but does not establish a happens-before relationship; the race and its undefined behavior remain. (90% fail)
