go
build_error
ai_generated
true
go: -mod=vendor is set but vendor directory is missing or incomplete
ID: go/vendor-directory-missing
80%Fix Rate
90%Confidence
0Evidence
2024-09-12First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 1.21 | active | — | — | — |
| 1.22 | active | — | — | — |
| 1.23 | active | — | — | — |
Root Cause
The vendor directory does not exist or lacks required dependencies when using vendor mode.
generic中文
使用 vendor 模式时,vendor 目录不存在或缺少必需的依赖项。
Workarounds
-
95% success Run 'go mod vendor' to populate the vendor directory.
Execute 'go mod vendor' in the module root to copy all dependencies.
-
90% success Use -mod=mod flag to bypass vendor mode.
Build with 'go build -mod=mod' to use module cache instead of vendor.
Dead Ends
Common approaches that don't work:
-
Creating an empty vendor directory manually.
100% fail
Go expects the vendor directory to contain all dependencies; empty directory causes build failures.
-
Setting GOFLAGS=-mod=mod to ignore vendor.
30% fail
This works but doesn't fix the vendor issue; it's a workaround, not a fix.