报错解决

  • 报错描述
For more information, see 'go help module-auth'.
gateway2-http-command-async/cmd/appservice imports
        github.com/edgexfoundry/app-functions-sdk-go/v2/pkg/transforms imports
        github.com/edgexfoundry/go-mod-core-contracts/v2/common: github.com/edgexfoundry/go-mod-core-contracts/v2@v2.1.0: verifying module: checksum mismatch
        downloaded: h1:QIb6pcSYxL9F4TDnZOZk7+USnZ8Nivz1hHxmoAFNPVM=
        sum.golang.org: h1:uphot3ZKOH0/aoo/Y5gr2NCRgGzy9RksWsXKtJRVEuQ=

SECURITY ERROR
This download does NOT match the one reported by the checksum server.
The bits may have been replaced on the origin server, or an attacker may
have intercepted the download attempt.

方案: 考虑换goproxy解决,有可能时代理中存储的签名和sum.golang.org存储的签名不同

  • 报错描述

在go module 项目中, 全局配置过 GOPROXY=“https://goproxy.io” 此时如果要用go get github.com/xxx/xxx 的包是完全可以导入的(实际是从 https://goproxy.io/github.com/xxx/xxx 来下载包的

但是如果要导入的包是私有仓库比如 gitpack.xxx.cn/myutil/help 实际是从 https://goproxy.io/gitpack.gitpack.xxx.cn/myutil/help 这时一定是返回http 404错误的 报错如下

If your Go version >= 1.13, the GOPRIVATE environment variable controls which modules the go command considers to be private (not available publicly) and should therefore not use the proxy or checksum database.

要导入私有git仓库的包需要设置go 环境变量GOPRIVATE go env -w GOPRIVATE=".xxx.cn" 或者直接设置环境变量GOPRIVATE=.xxx.cn 再用 go get -u gitpack.xxx.cn/myutil/help@分支名(标签名) 就可以成功导入私有包了