go
build_error
ai_generated
true
go: missing go.sum entry for module providing package X; to add: go mod tidy
ID: go/go-mod-tidy-missing-go-sum-entry-for-module-providing-package
98%Fix Rate
90%Confidence
1Evidence
2023-05-10First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| go1.20 | active | — | — | — |
| go1.21 | active | — | — | — |
| go1.22 | active | — | — | — |
Root Cause
The go.sum file is missing checksums for a dependency required by the current module, often after adding a new import or updating go.mod manually.
generic中文
go.sum 文件缺少当前模块所需依赖项的校验和,通常是在添加新导入或手动更新 go.mod 后发生。
Official Documentation
https://go.dev/ref/mod#go-sum-filesWorkarounds
-
98% success Run 'go mod tidy' to regenerate go.sum with all required checksums
Run 'go mod tidy' to regenerate go.sum with all required checksums
-
95% success If go mod tidy fails, run 'go mod download' first, then 'go mod tidy'
If go mod tidy fails, run 'go mod download' first, then 'go mod tidy'
-
93% success For vendored projects, run 'go mod vendor' after tidy to sync vendor directory
For vendored projects, run 'go mod vendor' after tidy to sync vendor directory
中文步骤
运行 'go mod tidy' 重新生成包含所有必需校验和的 go.sum
如果 go mod tidy 失败,先运行 'go mod download',再运行 'go mod tidy'
对于使用 vendor 的项目,在 tidy 后运行 'go mod vendor' 以同步 vendor 目录
Dead Ends
Common approaches that don't work:
-
Manually edit go.sum to add the missing checksum
95% fail
go.sum is machine-generated and manual edits are overwritten or cause checksum mismatches
-
Delete go.sum and go.mod and start over
80% fail
Deletes all dependency info; may lose version constraints and cause other errors
-
Set GONOSUMCHECK=* to bypass checksum verification
50% fail
Disables security verification and is not portable across builds