go
build_error
ai_generated
true
go: /path/to/project 中的 vendoring 不一致:vendor/modules.txt 已过期
go: inconsistent vendoring in /path/to/project: vendor/modules.txt is out of date
ID: go/go-mod-tidy-inconsistent-vendoring
80%修复率
87%置信度
0证据数
2024-04-01首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 1.14 | active | — | — | — |
根因分析
vendor 目录中的 modules.txt 与 go.mod 中的要求不匹配,通常是在添加/删除依赖后未运行 go mod vendor 导致。
English
The vendor directory's modules.txt does not match the requirements in go.mod, often due to adding/removing dependencies without running go mod vendor.
解决方案
-
95% 成功率
Run 'go mod vendor' to regenerate the vendor directory and modules.txt from go.mod.
-
90% 成功率
Run 'go mod tidy' to clean up go.mod, then 'go mod vendor' to sync.
无效尝试
常见但无效的做法:
-
80% 失败
The file is auto-generated; manual edits will be overwritten or cause further inconsistencies.
-
60% 失败
Without re-vendoring, builds will fail if modules are not in cache or network is unavailable.