The module cache and the build cache are separate entities.

The build cache is safe for concurrent use. The module cache is not (yet),¹ 
but you can pre-populate it by running go mod download.

¹ https://golang.org/issue/26794


On Tuesday, August 28, 2018 at 11:01:43 AM UTC-4, Maxim Khitrov wrote:
>
> 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/browser@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-spew@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-difflib@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 
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to