Available in Nexus Repository OSS and Nexus Repository Pro
Nexus Repository Manager OSS and Nexus Repository Manager Pro support Go modules dependency resolution using proxy and group repositories. Go packages can now be cached and served from NXRM using a single endpoint, without builds incurring repeated downloads of packages from the public internet.
This format is disabled by default in Professional HA-C environments.
The Go programming language natively uses the underlying version control system for fetching dependencies, for example Github.com, whereby the Go command line will use git to perform a full clone of all required dependencies. The Go community realised that this has a number of negative impacts for any typical CI process. Cloning repositories can be a time consuming process. Additionally, fetching sources from any number of version control systems such as Github excludes the ability of a proxying mechanism such as that provided by Nexus Repository Manager. To solve this problem, Go introduced the GOPROXY environment variable.
Learn more on Go dependency management by reading the technical guide.
With the introduction of Go modules, the community also introduced an environment variable
$GOPROXY and, when set, all modules are fetched using a Download API using the base url as the proxying endpoint. The Nexus Repository Manager requires the setting of the
$GOPROXY environment variable pointing to a Go repository.
Proxying Go Repositories
You can set up a Go proxy repository to access a remote repository location.
At the time of this writing, it must be noted that there is currently no official central repository for Go. It is the client responsibility to choose a repository to proxy, be that public or locally hosted setup, such as using an Athens server.
To proxy a Go repository, you simply create a new go (proxy) as documented in Repository Management.
Minimal configuration steps are:
- Define Name, e.g. go-proxy
- Define URL for Remote storage, e.g.
- Pick a Blob store for Storage
At the time of implementation of the Go repository in NXRM, the Go client does not have a means of authentication. This means NXRM instances with anonymous disabled will not be able to reach the Go endpoints, rendering proxy useless. See here for details on anonymous security.
Grouping Go Repositories
A repository group is the recommended way to expose all your Go repositories. A repository group allows you to expose the aggregated content of multiple Go repositories with one URL; it is this url that you should set the
$GOPROXY environment variable url to.
To create a Go group repository, create a new repository using the recipe go (group) as documented in Repository Management.
Minimal configuration steps are:
Select Blob store for Storage
Add Go repositories to the Members list in the desired order
Go configuration examples
If you need to access dependencies from authenticated sources, you'll need to run Athens internally; this locally hosted server is able to be configured with authentication credentials to access private repositories. You may still decide to proxy an external server to avoid unnecessary duplication of caching and therefore storage space.
The following diagram depicts an example set up: