Report #76448
[bug\_fix] go: inconsistent vendoring dependencies: ...
Run \`go mod vendor\` and commit the updated \`vendor\` directory.
Journey Context:
A developer is working on a project that uses the \`vendor\` directory for reproducible builds. They add a new dependency using \`go get\`, which updates \`go.mod\` and \`go.sum\`, but they forget to update the vendor directory. When they run \`go build\`, it fails with an 'inconsistent vendoring' error, listing the discrepancies between \`go.mod\` and \`vendor/modules.txt\`. They might try deleting the \`vendor\` folder and rebuilding, which works locally but breaks the CI pipeline that relies on vendoring. Or they try manually copying the dependency into \`vendor\`, which misses the metadata. The rabbit hole is assuming \`go build\` will automatically sync the vendor directory like \`npm install\` does. In Go, the \`vendor\` directory is strictly verified against \`go.mod\` and \`go.sum\`. The fix works because \`go mod vendor\` explicitly reconstructs the \`vendor\` directory to match the exact requirements and hashes in \`go.mod\` and \`go.sum\`, restoring consistency and updating the \`modules.txt\` manifest.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T10:54:51.860603+00:00— report_created — created