go config_error ai_generated true

go: GOPROXY=off 已禁用模块查找

go: module lookup disabled by GOPROXY=off

ID: go/module-lookup-directory-error

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

版本兼容性

版本状态引入弃用备注
1.13 active

根因分析

GOPROXY 环境变量设置为 'off',禁用了所有模块下载的网络访问,但模块不在本地缓存中。

English

The GOPROXY environment variable is set to 'off', disabling all network access for module downloads, but the module is not in the local cache.

generic

解决方案

  1. 95% 成功率
    Set GOPROXY=https://proxy.golang.org,direct in your environment or go env -w GOPROXY=https://proxy.golang.org,direct
  2. 85% 成功率
    If offline, use GOFLAGS=-mod=vendor and ensure all dependencies are vendored with go mod vendor beforehand.

无效尝试

常见但无效的做法:

  1. 40% 失败

    The environment variable may be overridden by a .env file or Makefile; the shell change may not persist.

  2. 70% 失败

    If the module is not already vendored, go mod vendor will still attempt to download it and fail.