Skip to content

Publish and resolve Go modules ​

The Go toolchain reads modules through GOPROXY. A published version has .info, .mod, and .zip objects. Verify the setup from a clean module cache and compare against the consuming project’s go.sum.

Create repositories ​

Run these Bash commands with an authenticated administrator arkactl profile and jq. Replace the example address with your HTTPS endpoint. Publish to Hosted. Group looks in Hosted first, then in Proxy. Grant the publishing account write access to Hosted and the consuming account read access to Group and the relevant members.

For each consuming or publishing identity, sign in with its profile and run arkactl --json tokens create --name go-ci --expires-in-days 30 | jq -er .plaintext. Send the output directly to the CI secret store. Use a separate read and write token for the examples below.

bash
export ARKA_URL=https://packages.example.org
hosted=$(arkactl --json repo create --name go-hosted --type hosted --format go | jq -er .id)
proxy=$(arkactl --json repo create --name go-proxy --type proxy --format go \
  --upstream-url https://proxy.golang.org | jq -er .id)
arkactl repo create --name go-group --type group --format go --member "$hosted,$proxy"
WRITE="$ARKA_URL/repository/go-hosted"
READ="$ARKA_URL/repository/go-group"

Upload a module ​

For example.org/acme/widget@v1.2.3, put {"Version":"v1.2.3","Time":"2026-01-01T00:00:00Z"} in v1.2.3.info and the version’s go.mod in .mod. Every ZIP path starts with example.org/acme/widget@v1.2.3/. Inject an ARKA_WRITE_TOKEN with write access through CI.

bash
for ext in mod zip info; do
  curl -fsS -H "Authorization: Bearer $ARKA_WRITE_TOKEN" \
    -T "v1.2.3.$ext" "$WRITE/example.org/acme/widget/@v/v1.2.3.$ext" || exit 1
done

Configure consumers ​

Set the workstation default with go env -w GOPROXY=https://packages.example.org/repository/go-group. In CI, export the settings for the job only and fail on missing modules. Private modules bypass the public checksum service. Public dependencies follow the Go checksum policy.

bash
export GOPROXY="$READ" GONOPROXY=none GONOSUMDB='example.org/acme/*'
export GOMODCACHE="$(mktemp -d)"
go mod download -json example.org/acme/widget@v1.2.3
go mod download
go mod verify

For a private HTTPS Group, provision a mode-0600 ~/.netrc entry of machine packages.example.org login READER password READ_TOKEN and inject credentials through CI. Check go env GOPROXY GOPRIVATE GONOPROXY GONOSUMDB. Commit the reviewed go.sum so later builds can verify downloads.

SymptomWhat to check
Module lists but a version returns 404Inspect @v/v1.2.3.info, .mod, and .zip separately. Escape capitals according to Go’s rules, for example Azure as !azure.
ZIP prefix errorInspect the archive root and verify the module path, major-version suffix, and version.
Checksum differs from go.sumCompare the build source and the published bytes. Publish changed source as a new version and retain the original checksum.

Go module proxy and checksum protocol

Released under the Apache 2.0 License.