go build_error ai_generated true

go: 模块 example.com/module:目录 "/home/user/go/pkg/mod/example.com/[email protected]" 未找到

go: module example.com/module: directory "/home/user/go/pkg/mod/example.com/[email protected]" not found

ID: go/module-directory-not-found

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

版本兼容性

版本状态引入弃用备注
1.11 active
1.12 active
1.13 active
1.14 active
1.15 active
1.16 active
1.17 active
1.18 active
1.19 active
1.20 active
1.21 active
1.22 active
1.23 active

根因分析

模块缓存缺少所需的版本目录,可能是由于缓存损坏或下载不完整。

English

The module cache is missing the required version directory, possibly due to a corrupted cache or incomplete download.

generic

解决方案

  1. 95% 成功率 Run 'go clean -modcache' and then 'go mod download'
    go clean -modcache && go mod download
  2. 90% 成功率 Run 'go mod tidy' to re-download and verify all dependencies
    go mod tidy

无效尝试

常见但无效的做法:

  1. Manually creating the directory and copying files 90% 失败

    The module cache is managed by Go; manual creation leads to checksum mismatches and broken references.

  2. Setting GOMODCACHE to a different path without clearing old cache 60% 失败

    The new path may not have the required module; the error persists if the module is not downloaded there.