# 缺少函数体

- **ID:** `go/missing-function-body`
- **领域:** go
- **类别:** compile_error
- **验证级别:** ai_generated
- **修复率:** 92%

## 根因

函数声明没有函数体，因为源文件被截断、函数定义在另一个未编译的文件中，或者构建标签导致函数体被排除。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| go1.21 | active | — | — |
| go1.22 | active | — | — |
| go1.23 | active | — | — |

## 解决方案

1. ```
   Provide the missing function body: define the function with a block, e.g., `func foo() int { return 0 }`.
   ```
2. ```
   If using build tags, ensure the file with the function body is included: `go build -tags "mytag" .` or remove conflicting tags.
   ```

## 无效尝试

- **** — The compiler requires an actual block {} not just a return; the function must have a body. (95% 失败率)
- **** — If the function is called elsewhere, removing it causes undefined errors. (80% 失败率)
