go.sum are different when using go mod vendor/download

本地Golang配置
在这里插入图片描述

今天本地编译一个项目,遇到以下错误

PS D:\Code\Golang\jiankunking\k8s-ext> go mod tidy
go: downloading github.com/huaweicloud/huaweicloud-sdk-go-obs v3.23.4+incompatible
verifying github.com/gin-gonic/[email protected]: checksum mismatch
        downloaded: h1:3U500Wp728rATEiFJtk1L7dhAbWobNDQC0Cbd4yhhdc=
        go.sum:     h1:aMBzLJ/GMEYmv1UWs2FFTcPISLrQH2mRgL9Glz8xows=

SECURITY ERROR
This download does NOT match an earlier download recorded in go.sum.
The bits may have been replaced on the origin server, or an attacker may
have intercepted the download attempt.

For more information, see 'go help module-auth'.

尝试过以下方案

go clean -modcache
rm go.sum
go mod tidy

无效

最终解决方案:

PS D:\Code\Golang\jiankunking\k8s-ext> $env:GOPROXY = "https://goproxy.cn"
PS D:\Code\Golang\jiankunking\k8s-ext> go mod tidy
go: downloading github.com/huaweicloud/huaweicloud-sdk-go-obs v3.23.4+incompatible
go: downloading github.com/gin-gonic/gin v1.7.3
go: downloading github.com/olivere/elastic v6.2.28+incompatible
go: downloading github.com/kedacore/keda/v2 v2.5.0
go: downloading k8s.io/kubectl v0.21.2
go: downloading github.com/mattn/go-sqlite3 v1.14.6
go: downloading github.com/gin-contrib/sse v0.1.0
go: downloading github.com/mattn/go-isatty v0.0.16
go: downloading github.com/onsi/ginkgo/v2 v2.6.0
go: downloading github.com/onsi/gomega v1.24.1
go: downloading github.com/fortytw2/leaktest v1.3.0
go: downloading github.com/pmezard/go-difflib v1.0.0
go: downloading github.com/go-playground/validator/v10 v10.11.1
go: downloading github.com/ugorji/go/codec v1.2.7
go: downloading github.com/kr/pretty v0.3.0
go: downloading github.com/satori/go.uuid v1.2.0
go: downloading knative.dev/pkg v0.0.0-20211123135150-787aec59e70a
go: downloading github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5
go: downloading github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153
go: downloading github.com/go-logr/zapr v1.2.3
go: downloading go.uber.org/zap v1.24.0
go: downloading github.com/kr/text v0.2.0
go: downloading github.com/rogpeppe/go-internal v1.8.0
go: downloading github.com/go-playground/universal-translator v0.18.0
go: downloading github.com/leodido/go-urn v1.2.1
go: downloading golang.org/x/crypto v0.1.0
go: downloading github.com/go-playground/assert/v2 v2.0.1
go: downloading github.com/onsi/ginkgo v1.16.5
go: downloading github.com/go-playground/locales v0.14.0
go: downloading go.uber.org/atomic v1.9.0
go: downloading go.uber.org/multierr v1.6.0
go: downloading github.com/fsnotify/fsnotify v1.6.0
go: downloading golang.org/x/mod v0.6.0
go: downloading github.com/evanphx/json-patch v4.12.0+incompatible
go: downloading k8s.io/klog v1.0.0
go: downloading github.com/ugorji/go v1.2.7
go: downloading github.com/blang/semver v3.5.1+incompatible
go: downloading github.com/emicklei/go-restful v2.15.0+incompatible
go: downloading github.com/cespare/xxhash v1.1.0
PS D:\Code\Golang\jiankunking\k8s-ext>

你可能感兴趣的:(Go,golang,开发语言,后端)