To install the Go client, please refer to the The Go Programming Language documentation.
If you are using Homebrew you can also install the Go client by running:
brew install go
Once you have installed the Go client, you can then install vgo by running:
To deploy Go packages to a local Go registry and enable calculation of Go package metadata, set Go to be the Package Type when you create your local repository.
Artifacts (such as zip files) requested from a remote Go registry are cached on demand. You can remove downloaded artifacts from the remote repository cache, however you can not manually deploy artifacts to a remote repository.
To define a remote repository to proxy github.com, follow the steps below:
- Create a new remote repository and set Go to be its Package Type
- Set the Repository Key value, and enter
https://github.comin the URL field as displayed below
- Click "Save & Finish"
A Virtual Repository defined in Artifactory aggregates packages from both local and remote repositories.
This allows you to access both locally hosted Go packages and packages from remote proxied Go registries from a single URL defined for the virtual repository.
To create a virtual repository as a Go registry set Go to be its Package Type, and select the underlying local and remote repositories to include under the Repositories section.
To allow Artifactory to access the metadata that contains the Remote Import Paths that describe where on GitHub to obtain the source code of the Go packages in your virtual repositories, the Enable Dependency Rewrite checkbox should be set (this is the default).
Enable Dependency Rewrite
|When checked, automatically rewriting external dependencies is enabled.|
A white list of Ant-style path expressions that specify where external metadata containing Remote Import Paths may be downloaded from. By default, this is set to
Using Go with Artifactory
Much of your work with Go and Artifactory is done through JFrog CLI, a thin client that wraps the vgo client. To learn more, please refer to the JFrog CLI User Guide.
Did you know?
JFrog CLI is, itself, written in Go
Resolving Go Projects
go.mod is a metadata file that describes a Go package. It contains the package's module name and a list of its dependencies.
To allow successful resolution of a package, the vgo client requires its corresponding
go.mod file to be found in the same folder.
For example, in this "Hello Worlds" Go project, the go.mod file specifies a module
github.com/you/hello, with a single dependency,
Resolving Transitive Dependencies Locally
To fully resolve a Go project, each transitive dependency needs to have its corresponding go.mod file in place in the same folder where it resides. However, in many cases, the go.mod file does not exist. To resolve a Go project in this case, follow these steps:
- Manually download all required dependencies from the internet to your local machine
- Run your build while resolving dependencies locally
- Publish your built package to Artifactory as described below.
From this point on, you can rebuild your project while resolving dependencies from Artifactory
Building Go Packages
To build your Go projects, use JFrog CLI. JFrog CLI downloads the dependencies needed for the project from the internet and creates the corresponding
go.mod file. When you later use JFrog CLI to publish your package to Artifactory, the go.mod file is uploaded alongside the package to Artifactory.
For details, please refer to the JFrog CLI documentation.
Publishing Go Projects
The Go client works through a Git repository which hosts the Go package source code, and does not provide a way to directly publish packages to Artifactory.
To publish your package to Artifactory, use JFrog CLI as described in the JFrog CLI documentation.