go
module_error
ai_generated
true
go: 模块 github.com/foo/bar@latest: 未找到模块
go: module github.com/foo/bar@latest: module not found
ID: go/go-mod-tidy-module-not-found
92%修复率
88%置信度
1证据数
2023-06-01首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| Go 1.20 | active | — | — | — |
| Go 1.21 | active | — | — | — |
| Go 1.22 | active | — | — | — |
根因分析
指定的模块版本在模块代理或仓库中不存在,通常由于拼写错误或版本未发布。
English
The specified module version does not exist in the module proxy or repository, often due to a typo or unpublished version.
官方文档
https://go.dev/ref/mod#go-mod-tidy解决方案
-
Verify the module path and version: run 'go list -m github.com/foo/bar@latest' to check if the module exists.
-
Use a specific version instead of @latest: 'go get github.com/foo/[email protected]' after confirming the version exists.
-
Clear module cache and retry: 'go clean -modcache' then 'go mod tidy'
无效尝试
常见但无效的做法:
-
80% 失败
The -e flag only continues despite errors, but the module still won't be found, leaving the build broken.
-
60% 失败
Does not resolve the missing module; go mod tidy will still fail.
-
70% 失败
If the module is not found locally or on the proxy, this will not help; it may even worsen the situation by disabling proxy entirely.