Context
执行 go mod tidy
报错
$ go mod tidy
go: verifying github.com/docker/docker@v1.13.1: checksum mismatch
Expect (go version go1.12.9 darwin/amd64):
$ go mod tidy -v
go: downloading github.com/panjf2000/ants v1.2.0
go: extracting github.com/panjf2000/ants v1.2.0
Actual (go version go1.13 darwin/amd64)
$ go mod tidy -v
verifying github.com/panjf2000/ants@v1.2.0: checksum mismatch
downloaded: h1:Ufw4aDz9RqH1RVblx2W9L9Uv5vSX5apbX5+peR7LQ5k=
sum.golang.org: h1:pMQ1/XpSgnWx3ro4y1xr/uA3jXUsTuAaU3Dm0JjwggE=
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.
For more information, see 'go help module-auth'.
解决办法
Solution 1
There is a fundamental solution to this kind of issue:
$ go clean -modcache
# Remove go.sum
$ rm go.sum
# Then re-generate go.sum
$ go mod tidy
Solution 2
Important thing: Close your IDE! I had that problem with GoLand. Close IDE and repeat the steps:
$ cd /another/path
$ go clean -modcache
$ cd /project/path
$ go mod tidy
Solution 3
How resolve issue step by step (macOS):
$ sudo go clean -modcache
$ git checkout go.sum
$ go mod tidy -v
for Linux:
$ cd /another/path
$ go clean -modcache
$ cd /project/path
$ go mod tidy
Reference
FEATURED TAGS
algorithm
algorithmproblem
architecturalpattern
architecture
aws
c#
cachesystem
codis
compile
concurrentcontrol
database
dataformat
datastructure
debug
design
designpattern
distributedsystem
django
docker
domain
engineering
freebsd
git
golang
grafana
hackintosh
hadoop
hardware
hexo
http
hugo
ios
iot
java
javaee
javascript
kafka
kubernetes
linux
linuxcommand
linuxio
lock
macos
markdown
microservices
mysql
nas
network
networkprogramming
nginx
node.js
npm
oop
openwrt
operatingsystem
padavan
performance
programming
prometheus
protobuf
python
redis
router
security
shell
software testing
spring
sql
systemdesign
truenas
ubuntu
vmware
vpn
windows
wmware
wordpress
xml
zookeeper