The starter set includes the go-proxy proxy repository (a proxy.golang.org mirror), the go-hosted hosted repository (private modules), and go-sumdb — a proxy repository of the sum.golang.org checksum database.

Connecting to the proxy

Set the environment variables (or store them with go env -w):

export GOPROXY="https://<GALLEON_HOST>/repository/go-proxy"
export GOSUMDB="sum.golang.org https://<GALLEON_HOST>/repository/go-sumdb"
go get rsc.io/quote

GOSUMDB takes two space-separated values — the database name and the proxy repository address: the go client will verify checksums through Galleon without reaching the internet directly.

Private modules

Private modules are published to go-hosted, while public ones keep coming through go-proxy — list both sources in GOPROXY (on a 404 response the client moves on to the next address):

export GOPROXY="https://<GALLEON_HOST>/repository/go-hosted,https://<GALLEON_HOST>/repository/go-proxy"
export GOPRIVATE="example.com/private-*"
export GONOPROXY="none"
go mod download example.com/private-x/lib@v1.0.0

Private modules are absent from the public checksum database, so GOPRIVATE disables checksum verification for their paths.

GONOPROXY="none" is mandatory: without it, GOPRIVATE routes private module requests directly to the version control system, bypassing Galleon.

The go client reads credentials from the ~/.netrc file:

machine <GALLEON_HOST>
login <USERNAME>
password <PASSWORD>

Publishing

Go has no standard publish command — module files are uploaded to the module proxy protocol paths:

curl -u <USERNAME>:<PASSWORD> -T v1.0.0.mod https://<GALLEON_HOST>/repository/go-hosted/example.com/foo/@v/v1.0.0.mod
curl -u <USERNAME>:<PASSWORD> -T v1.0.0.zip https://<GALLEON_HOST>/repository/go-hosted/example.com/foo/@v/v1.0.0.zip

The .mod file must match the go.mod inside the .zip archive byte for byte. Re-uploading an already published version is rejected with 409 — module versions are immutable; publish a new version for a new build.

Specifics

Format specifics:

  • Version files (.zip, .mod, .info) are immutable by the Go protocol rules; how proxy repositories cache content and refresh version lists is described in Proxying and caching.
  • If GOSUMDB is not pointed at go-sumdb, the client verifies checksums directly against sum.golang.org — in an isolated network, configure both variables.