go build_error ai_generated true

go: 模块 example.com/[email protected] 需要 example.com/[email protected],但 go.sum 缺失或不包含该依赖的哈希值

go: module example.com/[email protected] requires example.com/[email protected], but go.sum is missing or does not contain hash for example.com/[email protected]

ID: go/module-path-mismatch

其他格式: JSON · Markdown 中文 · English
80%修复率
85%置信度
0证据数
2024-01-15首次发现

版本兼容性

版本状态引入弃用备注
1.16 active
1.17 active
1.18 active
1.19 active
1.20 active
1.21 active
1.22 active
1.23 active

根因分析

go.sum 文件与 go.mod 文件不同步,通常是由于手动编辑或未完全执行 'go mod tidy' 导致。

English

The go.sum file is out of sync with the go.mod file, often due to manual edits or incomplete 'go mod tidy' execution.

generic

解决方案

  1. 95% 成功率 Run 'go mod tidy' to synchronize go.mod and go.sum
    go mod tidy
  2. 90% 成功率 Run 'go mod download' to fetch missing dependencies and update go.sum
    go mod download

无效尝试

常见但无效的做法:

  1. Manually editing go.sum to add the missing hash 85% 失败

    go.sum is a checksum file; manual edits often introduce incorrect hashes, causing verification failures.

  2. Deleting go.mod entirely and recreating it 75% 失败

    Loses all dependency versions and module path, leading to more complex rebuild issues.