# 致命错误：所有 goroutine 处于休眠状态 - 死锁！
goroutine 1 [select (no cases)]：

- **ID:** `go/select-no-case-ready-blocks-forever`
- **领域:** go
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

select 语句没有就绪的 case 也没有 default，永久阻塞。如果它是唯一可运行的 goroutine，运行时会报告死锁。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 1.0+ | active | — | — |

## 解决方案

1. **** (92% 成功率)
   ```
   select {
case v := <-ch:
    return v
case <-time.After(5 * time.Second):
    return errors.New("timeout")
}
   ```
2. **** (95% 成功率)
   ```
   select {
case v := <-ch:
    return v, nil
case <-ctx.Done():
    return nil, ctx.Err()
}
   ```

## 无效尝试

- **** — Turns a blocking wait into a busy loop that spins CPU at 100%. (85% 失败率)
- **** — Polling with sleeps adds latency and still misses events under load. (80% 失败率)
