Hi,
> There are some packages however which I require which aren't yet updated to use a go.mod , maybe they never will be, others such as those in
golang.org/ and
gopkg.in/ I can't go get due to redirection, so have to manually git clone these into the correct path from the corresponding
github.com/ location .
You don't need to do anything manual, not even for non-module
dependencies. If you do a go mod download in your module, that will
ensure the module cache (at $GOPATH/pkg/mod/cache/download) is primed
for use offline.
If you want to get the subset of $GOPATH/pkg/mod/cache/download
relevant to your module, you could do something similar to:
go mod download
td=$(mktemp -d)
GOPROXY=file://$GOPATH/pkg/mod/cache/download GOPATH=$td go mod download
Then $td/pkg/mod/cache/download will be primed with everything your
module requires for offline use.
I use exactly this approach, and push the results to
https://github.com/myitcv/cachex for use in my CI:
> The other is how to locally curate such a module into my local proxy/cache.
> I need to build the zip for that package, which I've attempted according to the guidance in go help goproxy. For example the above package would be zipped as
golang.org/x/cry...@v0.0.1/ (just for simplicity I created the git tag v0.0.1 in this repo while I figure this out) and this would become $GOPROXY/
golang.org/x/crypto/@v/v0.0.1.zip (there is a corresponding .mod .info and line in list for v0.0.1).
You shouldn't need to manually build any zips; the go tool will do
everything for you.
Hopefully the steps above help to clear things up a bit?
Thanks,
Paul