Connect your Go Client to Artifactory

JFrog Artifactory Documentation

Products
JFrog Artifactory
Content Type
User Guide

This topic provides details on configuring your Go client to work with Artifactory. There are two methods for configuring your Go client with Artifactory:

Pre-requisites:

  • Before connecting your Go client to Artifactory, you must have an existing Go repository in Artifactory. For more information , see Create a Go Repository in Artifactory.

  • To deploy Go packages into an Artifactory repository, you first need to install and configure JFrog CLI. For more information on JFrog CLI and installation instructions, click here.

Supported Go Clients

Artifactory requires Go client version 1.11.0 and above.

To install the Go client, please refer to the Go Programming Language documentation.

Logged in vs. Anonymous User: You can work with Artifactory as either a logged in user or as an anonymous user. To work with Artifactory using Anonymous Access. you need to configure that access under Admin | Security | General. For details, refer to Allow Anonymous Access.Allow Anonymous Access

Configure your Native Go Client with Artifactory

To configure your native Go client to work with Artifactory:

  1. If you want to use an identity token instead of your Artifactory password for configuring your Go client with Artifactory, follow the instructions here.Generate Identity Token

    Note

    JFrog recommends using an identity token for configuring your Go client, as it has certain advantages over a user password. However, it is not strictly required.

  2. Set your default Artifactory Go repository by running the following command in the command line:

    export GOPROXY="https://<USERNAME>:<TOKEN>@<MY_JFROG_DOMAIN>/artifactory/api/go/<GO_REPO_NAME>"

    In the command above, replace the following placeholders as follows:

    • <USERNAME>: Replace with your username.

    • <TOKEN>: Replace with your identity token or Artifactory password.

    • <MY_JFROG_DOMAIN>: Replace with the name of your Artifactory domain.

    • <GO_REPO_NAME>: The name of your Go repository in Artifactory.

Configure your Go Client with Artifactory Using the JFrog CLI

To configure your Go client to work with Artifactory using the JFrog CLI:

  1. If you want to use an identity token instead of your Artifactory password for configuring your Go client with Artifactory, follow the instructions here.Generate Identity Token

    Note

    JFrog recommends using an identity token for configuring your Go client, as it has certain advantages over a user password. However, it is not strictly required.

  2. Configure the Artifactory server details by running the following command in the JFrog CLI:

    jf c add rt-server --artifactory-url https://<MY_JFROG_DOMAIN>/artifactory --user <USERNAME> --password <TOKEN> --interactive=false

    In the command above, replace the following placeholders as follows:

    • <USERNAME>: Replace with your username.

    • <MY_JFROG_DOMAIN>: Replace with the name of your Artifactory domain.

    • <TOKEN>: Replace with your identity token or Artifactory password.

  3. Configure the project with the Artifactory resolution repository.

    jf go-config --server-id-resolve rt-server --repo-resolve <GO_REPO_NAME>

    Where <GO_REPO_NAME> is the name of your Go repository in Artifactory.

Note

You can also use JFrog Set me up to copy the snippet populated with your token and environment. For more information, see Use Artifactory Set Me Up for Configuring Package Manager Clients.

Next Steps: