# fatal error: all goroutines are asleep - deadlock! (for-select with no default)

- **ID:** `go/goroutine-for-select-no-default`
- **Domain:** go
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

A for-select loop with no default case and all channels blocked causes goroutine to sleep forever.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.0 | active | — | — |
| 1.20 | active | — | — |

## Workarounds

1. **Add default case to avoid blocking** (95% success)
   ```
   for {
    select {
    case <-ch:
        // handle
    default:
        // non-blocking
    }
}
   ```
2. **Use a done channel to break out of loop** (90% success)
   ```
   done := make(chan struct{})
for {
    select {
    case <-ch:
        // handle
    case <-done:
        return
    }
}
   ```

## Dead Ends

- **Adding time.Sleep inside loop** — Sleep doesn't unblock channels; goroutine still blocked. (90% fail)
- **Using break statement to exit loop** — Break only exits select, not for loop; goroutine re-enters select and blocks again. (80% fail)
