I'd like to be able to use go mod download to download packages to another 
directory than GOPATH/pkg/mod and automatically have all go commands be 
aware of this new location.


This is specifically for CI/CD to ensure I can download modules in one 
stage and use them in subsequent stages.


I'm the author of https://estafette.io/, and just like Bitbucket Pipelines 
and Drone.io it executes steps in (public) docker containers, but the only 
data passed from stage to stage are the files inside the working directory. 
So downloading modules to a directory outside of the working directory 
makes them get downloaded again in subsequent stages.


NPM tackles this by having the node_modules directory as a local 
subdirectory of your repository, but of course this loses you the 
performance advantage of having a shared cache for all your repositories.


Nuget uses a global cache as well, but they allow you to specify an 
alternative location that gets used by their other commands by running dotnet 
restore --packages .nuget/packages.


A similar approach as dotnet takes would be best for all go module related 
commands to be able to prevent CI/CD from downloading the same modules 
multiple times. This could look something like go mod download -dir 
module_cache.

-- 
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