I'm running into non-deterministic errors when I try to build multiple
binaries from the same module with goreleaser in a CI/CD system. Here
are some examples:
go: finding
github.com/pkg/browser v0.0.0-20170505125900-c90ca0c84f15
go:
github.com/pkg/bro...@v0.0.0-20170505125900-c90ca0c84f15: git
fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in
/go/pkg/mod/cache/vcs/8755ee3fe34afbf0e42bd94de4ff233c0a12a60e9ddcc7a72c38f16620d3eebf:
chdir /go/pkg/mod/cache/vcs/8755ee3fe34afbf0e42bd94de4ff233c0a12a60e9ddcc7a72c38f16620d3eebf:
no such file or directory
go:
github.com/davecgh/go-...@v1.1.1: git remote add origin
https://github.com/davecgh/go-spew in
/go/pkg/mod/cache/vcs/b9a4b9bbdb4a59723f2348415ad7ffda91568455a1cfd92e97976132bdfbaf57:
exit status 128:
fatal: remote origin already exists.
go:
github.com/pmezard/go-di...@v1.0.0: unknown revision v1.0.0
go: error loading module requirements
If I run 'go mod download' before the build, everything works fine, so
I believe that this problem is caused by goreleaser starting multiple
parallel builds with an empty module cache. I've tested this several
times now by removing pkg/mod and GOCACHE directories.
My question is whether it should be possible to do so or if this is
just a known limitation of how the module cache works? The following
issue suggests that GOCACHE is safe for concurrent use, but I couldn't
find information on the module cache:
https://github.com/golang/go/issues/26677
-Max