go
module_error
ai_generated
true
go:github.com/foo/[email protected]:读取修订版本 v1.2.3 的 go.mod 时出错:未知修订版本 v1.2.3
go: github.com/foo/[email protected]: reading github.com/foo/bar/go.mod at revision v1.2.3: unknown revision v1.2.3
ID: go/go-mod-tidy-wrong-version
85%修复率
85%置信度
1证据数
2024-01-20首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| go1.21 | active | — | — | — |
| go1.22 | active | — | — | — |
| go1.23 | active | — | — | — |
根因分析
请求的模块版本在远程仓库中不存在,通常是由于拼写错误、标签不匹配或标签缺失。
English
The requested module version does not exist in the remote repository, often due to a typo, tag mismatch, or missing tag.
官方文档
https://go.dev/ref/mod#go-mod-tidy解决方案
-
Verify the tag exists in the remote repository using 'git ls-remote --tags https://github.com/foo/bar' and correct the version in go.mod.
-
Use 'go list -m -versions github.com/foo/bar' to list all available versions and choose a valid one.
无效尝试
常见但无效的做法:
-
Running 'go clean -modcache' and retrying.
95% 失败
The cache is not the issue; the version truly doesn't exist in the remote repo.
-
Adding a replace directive in go.mod pointing to a local path.
60% 失败
This only works if the local path contains the correct code; it doesn't fix the remote version mismatch.