21 lines
1.0 KiB
Markdown
21 lines
1.0 KiB
Markdown
# 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`):
|
|
|
|
```sh
|
|
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`.
|