# go: go.mod 要求 go >= 1.22.0（当前运行 go 1.21.5；GOTOOLCHAIN=local）

- **ID:** `go/toolchain-not-available`
- **领域:** go
- **类别:** toolchain_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

go.mod 声明的 Go 版本高于已安装的工具链，且 GOTOOLCHAIN=local 阻止自动下载工具链。

## 版本兼容性

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

## 解决方案

1. **** (95% 成功率)
   ```
   GOTOOLCHAIN=auto go build ./...
   ```
2. **** (90% 成功率)
   ```
   go install golang.org/dl/go1.22.0@latest
~/go/bin/go1.22.0 download
~/go/bin/go1.22.0 build ./...
   ```

## 无效尝试

- **** — may use language features unavailable in 1.21, causing compile errors (60% 失败率)
- **** — off is not a valid value; use local (100% 失败率)
- **** — the build does not proceed (100% 失败率)
