问题症状
执行 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
有。
- https://gosum.io/lookup/gopkg.in/ini.v1@v1.66.2
- https://sum.golang.google.cn/lookup/gopkg.in/ini.v1@v1.66.2
解决方式
更换 GOSUMDB
配置:
# Bash (Mac/Linux):
export GOSUMDB=sum.golang.google.cn
# PowerShell (Windows):
$env:GOSUMDB = "sum.golang.google.cn"