gox
gox copied to clipboard
Run "go mod download" before builds if in modules mode
As discussed in golang/go#26794, multiple processes of the go command cannot be safely run concurrently in the case where it installs new modules, since the installations will race. Since gox runs multiple concurrent go build processes, it can potentially encounter this problem.
The recommendation in that other issue is to run go mod download before the build begins in order to populate the local cache of modules, after which it is safe to run concurrent go build as long as no new dependencies have been introduced in the mean time.
Since go mod download doesn't exist in Go versions prior to 1.11, it may be necessary to run it only selectively depending on the Go version.