Go语言执行go get 或 go install 等安装操作时,gosum.io 404 Not Found 报错误问题

原创
2022/03/01 13:41
阅读数 156

问题症状

执行 kratos upgrade 报错:

go install github.com/go-kratos/kratos/cmd/kratos/v2@latest
go install: github.com/go-kratos/kratos/cmd/kratos/v2@latest: github.com/go-kratos/kratos/cmd/kratos/v2@v2.0.0-20220301040457-03ad2b663624 requires
        github.com/spf13/cobra@v1.3.0 requires
        github.com/spf13/viper@v1.10.0 requires
        gopkg.in/ini.v1@v1.66.2: verifying go.mod: gopkg.in/ini.v1@v1.66.2/go.mod: reading https://gosum.io/lookup/gopkg.in/ini.v1@v1.66.2: 404 Not Found
        server response: Not Found
exit status 1

原因:gosum.io中没有该包的信息,但是sum.golang.google.cn / sum.golang.org有。

解决方式

更换 GOSUMDB 配置:

# Bash (Mac/Linux):
export GOSUMDB=sum.golang.google.cn

# PowerShell (Windows):
$env:GOSUMDB = "sum.golang.google.cn"

参考: https://goproxy.io/zh/docs/GOSUMDB-env.html

展开阅读全文
加载中
点击引领话题📣 发布并加入讨论🔥
0 评论
0 收藏
0
分享
返回顶部
顶部