go
module_error
ai_generated
true
go: 模块要求 Go 1.22,但您的 Go 版本是 go1.20
go: module github.com/example/[email protected] requires go 1.22, but your Go version is go1.20
ID: go/unsupported-go-version-in-module
80%修复率
89%置信度
0证据数
2025-04-10首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 1.20 | active | — | — | — |
| 1.21 | active | — | — | — |
| 1.22 | active | — | — | — |
根因分析
模块依赖需要比已安装版本更新的 Go 版本。
English
A module dependency requires a newer version of Go than what is installed.
解决方案
-
95% 成功率 Upgrade your Go installation to a compatible version.
Download and install Go 1.22 or later from golang.org/dl/.
-
80% 成功率 Use a older version of the module that supports your Go version.
Run 'go list -m -versions github.com/example/mod' and downgrade to an older version in go.mod.
无效尝试
常见但无效的做法:
-
Setting GOTOOLCHAIN to force using an older version.
70% 失败
GOTOOLCHAIN only affects the toolchain selection; if the module requires a newer Go, it won't compile.
-
Removing the go directive from the dependency's go.mod.
100% 失败
You cannot modify third-party modules; the requirement is enforced.