# warning: goroutine leak detected (in goroutine 5)

- **ID:** `go/goroutine-leak-without-waitgroup`
- **Domain:** go
- **Category:** resource_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Goroutines that never exit due to blocked channel operations or infinite loops leak memory.

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   var wg sync.WaitGroup
wg.Add(1)
go func() {
    defer wg.Done()
    // do work
}()
wg.Wait()
   ```
2. **** (90% success)
   ```
   ctx, cancel := context.WithCancel(context.Background())
go func() {
    select {
    case <-ctx.Done():
        return
    case <-time.After(time.Second):
        // work
    }
}()
cancel()
   ```

## Dead Ends

- **** — GC doesn't collect goroutines; they are not garbage. (100% fail)
- **** — Temporary mitigation; eventually memory exhausts. (90% fail)
- **** — Leaks accumulate, causing OOM crashes. (80% fail)
