I recently started using modules in Go, but I frequently encounter issues where everything works fine on one machine, but a checksum mismatch is encountered when building the co
You can run go clean -modcache
and then go mod tidy
which will re-download all deps with the correct checksum (this updates the pkg cache in $GOPATH/pkg/mod/
).
To update vendor/
folder run: go mod vendor
.
Which version of Go are you using? There's a good chance you're running into the aftermath of the 1.11.2 -> 1.11.4
:
Which still isn't completely resolved. Remember that go mod
is still in development, so things like this will probably happen up and until 1.13.
Be sure to read up on minor releases for Go, and how these things can happen: https://github.com/golang/go/wiki/MinorReleases
TL;DR - Upgrade Go
You need to delete your package from the go.sum file. If you run from terminal mode, using CI/CD or Dockerfile you can use that sh command:
sed '/^github.com\/ericlagergren\/decimal@/d' ./go.sum > temp.txt && mv temp.txt go.sum
Which does:
P.S.: go mod tidy
- only removes unused packages and add new versions. But it doesn`t delete olders.
I was having the same problem using 1.12.8 and no cache cleaning would help. Turns out I am still locked in the middle of GOPATH and the Mod world. I found a flag in another post (How do I migrate from Dep to Go Modules) that did the trick for me.
go run -mod=vendor main.go
I had the same issue. I updated the go version and removed the imports from go.mod and removed all entries from go.sum and ran go mo tidy, which downloaded all the dependencies without any issues.