go data_error ai_generated true

go: github.com/foo/[email protected]: 打开 /root/go/pkg/mod/cache/download/github.com/foo/bar/@v/v1.0.0.zip: 没有那个文件或目录

go: github.com/foo/[email protected]: open /root/go/pkg/mod/cache/download/github.com/foo/bar/@v/v1.0.0.zip: no such file or directory

ID: go/module-cache-corrupt

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

版本兼容性

版本状态引入弃用备注
1.15 active
1.21 active

根因分析

模块缓存损坏或不完整,通常由于下载中断或手动删除。

English

The module cache is corrupted or incomplete, often due to interrupted downloads or manual deletion.

generic

解决方案

  1. 90% 成功率
    go clean -modcache github.com/foo/bar
  2. 95% 成功率
    rm -rf $(go env GOMODCACHE) && go mod download

无效尝试

常见但无效的做法:

  1. 40% 失败

    If the cache is corrupted, Go may still use the corrupted entry unless you clean it.

  2. 80% 失败

    The hash may not match, causing checksum errors.