go module_error ai_generated true

go: 模块 github.com/user/[email protected]: 读取 https://proxy.golang.org/github.com/user/private-repo/@v/v1.0.0.info: 404 Not Found

go: module github.com/user/[email protected]: reading https://proxy.golang.org/github.com/user/private-repo/@v/v1.0.0.info: 404 Not Found

ID: go/module-not-found-in-go-path

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

版本兼容性

版本状态引入弃用备注
go1.17 active
go1.18 active
go1.19 active
go1.20 active
go1.21 active

根因分析

Go 代理 (proxy.golang.org) 找不到该模块版本,可能是因为模块是私有的且无法通过默认代理访问,或者版本标签在仓库中不存在。

English

Go proxy (proxy.golang.org) cannot find the module version, either because the module is private and not accessible via the default proxy, or the version tag does not exist in the repository.

generic

官方文档

https://go.dev/ref/mod#private-modules

解决方案

  1. Set GONOSUMCHECK and GONOSUMDB, then use `GONOSUMCHECK=* GONOSUMDB=* GOPROXY=direct go get github.com/user/[email protected]` to bypass the proxy entirely.
  2. If the repo is private, configure git with a personal access token: `git config --global url."https://${GITHUB_TOKEN}:[email protected]/".insteadOf "https://github.com/"` then set `GOPRIVATE=github.com/user/private-repo`.

无效尝试

常见但无效的做法:

  1. 90% 失败

    Tidy doesn't bypass proxy; it still queries the same proxy URL which returns 404.

  2. 50% 失败

    The error is about module retrieval (404), not checksum verification.