go
build_error
ai_generated
true
go: vendoring 不一致:vendor 目录缺失,但设置了 -mod=vendor。请运行 'go mod vendor'。
go: inconsistent vendoring: vendor directory is missing, but -mod=vendor is set. Run 'go mod vendor'.
ID: go/vendor-directory-not-present
80%修复率
86%置信度
0证据数
2024-06-02首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 1.14 | active | — | — | — |
| 1.20 | active | — | — | — |
根因分析
项目配置为使用 vendoring(通过 -mod=vendor 或 GOFLAGS),但 vendor 目录不存在。
English
The project is configured to use vendoring (via -mod=vendor or GOFLAGS), but the vendor directory doesn't exist.
解决方案
-
95% 成功率
go mod vendor
-
80% 成功率
go build -mod=mod
无效尝试
常见但无效的做法:
-
100% 失败
Go expects specific files like modules.txt; empty dirs won't satisfy the build.
-
50% 失败
You may not control the build environment; the flag may be set in CI.