# 无法嵌入函数类型T

- **ID:** `go/cannot-embed-function-type`
- **领域:** go
- **类别:** type_error
- **验证级别:** ai_generated
- **修复率:** 92%

## 根因

Go不允许在结构体中直接嵌入函数类型；只有接口类型可以被嵌入。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Go 1.18 | active | — | — |
| Go 1.19 | active | — | — |
| Go 1.20 | active | — | — |

## 解决方案

1. ```
   Define an interface type with the same method signature and embed that interface instead
   ```
2. ```
   Use a named struct field with the function type
   ```

## 无效尝试

- **** — Embedding requires a type name, not a value; a function field is a different semantic (has-a vs is-a). (70% 失败率)
- **** — Aliases do not change the fundamental type category; embedding still fails. (90% 失败率)
