go build_error ai_generated true

缺少提供包 github.com/foo/bar 的模块的 go.sum 条目;要添加:go mod download github.com/foo/bar

missing go.sum entry for module providing package github.com/foo/bar; to add: go mod download github.com/foo/bar

ID: go/go-sum-missing-entry

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

版本兼容性

版本状态引入弃用备注
1.16 active
1.23 active

根因分析

依赖已添加到 go.mod 但 go.sum 未更新,通常因为使用 -mod=mod 而未运行 tidy。

English

A dependency was added to go.mod but go.sum was not updated, often due to using -mod=mod without tidy.

generic

解决方案

  1. 95% 成功率
    go mod tidy
  2. 90% 成功率
    go mod download github.com/foo/bar

无效尝试

常见但无效的做法:

  1. 40% 失败

    This will regenerate all entries but may take time and cause network issues.

  2. 100% 失败

    The hash must match exactly; a random hash will cause checksum mismatch.