# 致命错误：所有 goroutine 都处于休眠状态 - 死锁！

- **ID:** `go/channel-deadlock-no-receiver`
- **领域:** go
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

向无缓冲 channel 发送数据但没有并发的接收方，导致唯一的 goroutine 阻塞，没有任何可运行的 goroutine，从而触发运行时死锁检测。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 1.18 | active | — | — |
| 1.21 | active | — | — |
| 1.22 | active | — | — |

## 解决方案

1. **** (95% 成功率)
   ```
   ch := make(chan int)
go func() { fmt.Println(<-ch) }()
ch <- 42
   ```
2. **** (90% 成功率)
   ```
   ch := make(chan int, 1)
ch <- 42 // does not block
fmt.Println(<-ch)
   ```

## 无效尝试

- **** — Still no receiver ever reads, the spawned goroutine blocks forever and the main goroutine exits or deadlocks elsewhere. (70% 失败率)
- **** — Sleep does not create a receiver; if no goroutine reads, the send still blocks permanently. (85% 失败率)
