go toolchain_error ai_generated true

go: go.mod 要求 go >= 1.22.0(当前运行 go 1.21.5;GOTOOLCHAIN=local)

go: go.mod requires go >= 1.22.0 (running go 1.21.5; GOTOOLCHAIN=local)

ID: go/toolchain-not-available

其他格式: JSON · Markdown 中文 · English
80%修复率
90%置信度
0证据数
2024-06-10首次发现

版本兼容性

版本状态引入弃用备注
1.21+ active — — —
1.22+ active — — —

根因分析

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

English

go.mod declares a newer Go version than the installed toolchain, and GOTOOLCHAIN=local prevents automatic toolchain download.

generic

解决方案

  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 ./...

无效尝试

常见但无效的做法:

  1. 60% 失败

    may use language features unavailable in 1.21, causing compile errors

  2. 100% 失败

    off is not a valid value; use local

  3. 100% 失败

    the build does not proceed