29e4777eec
Private Go modules have nowhere to live: goproxy is remote-only, so internal modules need VCS access or a hand-rolled proxy. - serve local goproxy repos over the GOPROXY protocol (`@v/list`, `@latest`, `.info`/`.mod`/`.zip`) with case-encoded module paths - accept PUT uploads of `.zip`/`.mod`/`.info` per version; synthesize `.info` when absent - validate zips with `golang.org/x/mod/zip.CheckZip`, `.mod` module path and `.info` version before storing - add a ContentValidator hook so providers can check upload bytes - document publishing in the UI and `docs/goproxy/local.md`; add an e2e-docker case Reviewed-on: #143 Co-authored-by: unkin-agent <unkin-agent@unkin.net> Co-committed-by: unkin-agent <unkin-agent@unkin.net>
1.0 KiB
1.0 KiB
Local Go module proxy
A local goproxy repo serves private modules over the GOPROXY protocol
(@v/list, @latest, @v/<ver>.info|.mod|.zip). Publish a version by
uploading its files under the case-encoded module path (uppercase as !lower):
for ext in zip mod info; do
curl -fsSL --upload-file v0.1.0.$ext \
https://artifactapi.k8s.syd1.au.unkin.net/api/v2/remotes/go-internal/files/example.unkin.net/hello/@v/v0.1.0.$ext
done
GOPROXY=https://artifactapi.k8s.syd1.au.unkin.net/api/v1/local/go-internal,https://proxy.golang.org,direct \
GONOSUMDB=example.unkin.net go get example.unkin.net/hello@latest
Build the zip with golang.org/x/mod/zip or reuse the files go mod download
leaves in $(go env GOMODCACHE)/cache/download. Uploads are validated: zips must
pass zip.CheckZip (every file under module@version/), .mod must declare the
module, and .info must match the version. .info is optional; it is
synthesized from the version when absent. @v/list lists versions with a .mod.