Description
This is a proposal for extending the vgo download API to add a mechanism to allow proxies to redirect vgo to a VCS. This functionality would be useful if a proxy has only a subset of packages in a go.mod
file.
Currently, if someone adds two modules "a" v1.0.0
and "b" v1.0.0
to their go.mod
file and they then run GOPROXY=myprox.com vgo install
, everything works as expected if the proxy has both modules at the given versions. If not, the command fails.
It would be helpful to allow the proxy to tell vgo to fetch one or both of the modules from the VCS if it doesn't have them in its cache. This would be useful for proxy implementations where the proxy will not/cannot cache the module in its own storage or can but doesn't have that module/version in its cache. The Athens project is a present day use case for the latter - it fills its caches asynchronously.
One implementation possibility is adding a $GOPROXY/a/@v/v1.0.0?go-get=1
network request that expects the same output as already-existing ?go-get=1
requests define. This request could be made before starting the download protocol as it currently exists. The new mechanism would allow the proxy to choose to do one of the following for the given module and version identifier:
- Send vgo to the standard download API via the meta tag
- Send vgo to the VCS via the meta tag
- Return a 404