go build_error ai_generated true

go: inconsistent vendoring in /path/to/project: vendor/modules.txt is out of date

ID: go/go-mod-tidy-inconsistent-vendoring

Also available as: JSON · Markdown · 中文
80%Fix Rate
87%Confidence
0Evidence
2024-04-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
1.14 active

Root Cause

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.

generic

中文

vendor 目录中的 modules.txt 与 go.mod 中的要求不匹配,通常是在添加/删除依赖后未运行 go mod vendor 导致。

Workarounds

  1. 95% success
    Run 'go mod vendor' to regenerate the vendor directory and modules.txt from go.mod.
  2. 90% success
    Run 'go mod tidy' to clean up go.mod, then 'go mod vendor' to sync.

Dead Ends

Common approaches that don't work:

  1. 80% fail

    The file is auto-generated; manual edits will be overwritten or cause further inconsistencies.

  2. 60% fail

    Without re-vendoring, builds will fail if modules are not in cache or network is unavailable.