# 不能将类型 T 的值用作参数中的类型 *T

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

## 根因

函数期望接收指向类型的指针 (*T)，但传入了非指针值 (T)，导致类型不匹配。

## 版本兼容性

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

## 解决方案

1. ```
   Pass the address of the variable: `functionName(&variable)` instead of `functionName(variable)`.
   ```
2. ```
   If the variable is not addressable (e.g., map value), copy it first: `tmp := variable; functionName(&tmp)`.
   ```

## 无效尝试

- **** — Casting requires the value to be addressable; this often leads to another compilation error. (70% 失败率)
- **** — Modifying library or external function signatures is not always possible or breaks other code. (60% 失败率)
