go
module_error
ai_generated
true
go: 模块要求不兼容的依赖版本
go: github.com/example/[email protected] requires golang.org/x/[email protected], but go.mod requires golang.org/x/[email protected] (incompatible)
ID: go/mod-tidy-incompatible
80%修复率
86%置信度
0证据数
2024-08-05首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 1.20 | active | — | — | — |
| 1.21 | active | — | — | — |
| 1.22 | active | — | — | — |
根因分析
模块依赖要求与 go.mod 中指定的传递依赖版本不同,导致冲突。
English
A module dependency requires a different version of a transitive dependency than what is specified in go.mod, causing a conflict.
解决方案
-
75% 成功率 Update the conflicting dependency to a version that satisfies all requirements.
Run 'go get golang.org/x/[email protected]' and then 'go mod tidy' to resolve.
-
70% 成功率 Use a replace directive to force a version.
Add to go.mod: 'replace golang.org/x/text v0.3.0 => golang.org/x/text v0.4.0' if compatible.
无效尝试
常见但无效的做法:
-
Deleting go.sum and running 'go mod tidy' again.
70% 失败
The conflict is in go.mod; tidy will re-resolve but may not fix incompatibility.
-
Forcing an update with 'go get -u golang.org/x/[email protected]'.
60% 失败
This may break other dependencies that require v0.4.0.