Using private Go Modules

Once you have signed up for a Gemfury account, you can upload and install Go Modules.

Uploading packages by Go

We made a guide about creating a Go package and you can also learn from the Go blog website. Once you have the module, you can use Git to push your module to your Gemfury account.

To upload a module to your account, use the Git builder:

# Initial one-time setup
$ git remote add fury

# Push to build a new version
$ git push fury master
Username for '': <Your personal username>
Password for '': <Your personal password>

The USERNAME in the path of your repository URL is the destination of the build, however, the username and password for authentication are your account credentials. Usually the former is your team account, and the latter is a personal one.

Versioning releases

Go Modules on Gemfury are versioned with Semantic Versioning scheme derived from the tags of your Git repo. To release a new version, create a tag and push it to the Gemfury repo:

$ git tag v1.1.8
$ git push --tags fury master

Git builder always builds the tip of master. If the tip is not tagged, Gemfury will automatically generate a prerelease version of your package.

Your Repository URL

The repository URL is the Go Modules proxy URL for your Gemfury account and packages. Do not share this URL to keep your account private. Your Repo-URL has the following format:

When accessing only public packages in your Gemfury account, you do not need to specify a token in the Repo-URL:

Install Go Modules from Gemfury

Go uses a central proxy to collect a project’s dependencies. By default, it is configured to the public proxy run by Go’s patron-company (Google).

When you reconfigure your Go tooling to use Gemfury, our blending-proxy will first look for named packages in your account with the fallback to the public proxy for packages not found there.1

Set the following environment variables to configure Go to use Gemfury. This can be done in your terminal before running go or in a start-up shell script like $HOME/.profile:

$ export GOPROXY=
$ export GOPRIVATE="*"
$ export GONOPROXY=none

Please note that GOPRIVATE specifies the match pattern for the names of your private modules, and does not have to match your “” Repo-URL. Adjust it to match the names of modules you upload to Gemfury.

Once you have this configuration in place, start your build:

$ go build ./...

  1. Go does not support splitting public and private requests between two proxies. ↩︎