# 错误：读取 tcp 127.0.0.1:8080->127.0.0.1:34567：i/o超时（部分读取）

- **ID:** `go/io-reader-returns-partial-data-with-error`
- **领域:** go
- **类别:** io_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

I/O操作在读取部分数据后超时，导致应用程序获得不完整数据。

## 版本兼容性

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

## 解决方案

1. **Use io.ReadFull or io.ReadAll to ensure complete read** (90% 成功率)
   ```
   buf := make([]byte, 1024)
n, err := io.ReadFull(reader, buf)
if err != nil { /* handle partial read */ }
   ```

## 无效尝试

- **Ignoring partial read and using data anyway** — May corrupt application state; always check n and error. (90% 失败率)
