For the complete documentation index, see llms.txt. This page is also available as Markdown.

Go

spinner

Prerequisites

  • Ensure you have Go installed and configured on your local machine.

ADDITIONAL INFORMATION

Depending on your environment, you may need to run additional commands. Go to the Go installation guide for more information.

  • Ensure you have access to a Harness account with the appropriate permissions to create registries and connectors.

  • Ensure you have Harness CLI installed and running in your local machine.


Create a Go Artifact Registry

Create Go Artifact Registry in Harness
  1. Navigate to the Artifact Registry module in your Harness project.

  2. Click on New Artifact Registry.

  3. In the Registry Type list, select Go Registry.

  4. Provide a Registry Name.

    • The registry name must start with a letter and can include lowercase alphanumeric characters, underscores (_), periods (.), and hyphens (-).

  5. Optionally, add a Description and Labels for better organization.

  6. Choose visibility between Public and Private.

  7. Click Create Registry to finalize.

PRIVATE GO REGISTRY

This registry will serve as your private Go registry within Harness.


Configure an Upstream Proxy (Optional)

An upstream proxy allows your registry to fetch Go modules from external sources if they are not available locally.

Create an upstream proxy

Create a Go Upstream Proxy in Harness

Configure the upstream proxy in your registry

Configure Go Upstream Proxy in Harness

Create an upstream proxy

1. In the Artifact Registry module, click the dropdown next to **New Artifact Registry** and select **Upstream Proxy**. 2. Choose **Go Registry** as the proxy type. 3. Click **Create Proxy** to establish the connection.

Configure the upstream proxy in your registry

1. In the Artifact Registry module, select an existing Go Artifact Registry. 2. Select the **Configuration** tab. 3. Under **Advanced (Optional)**, select **Configure Upstream**. 4. Select from the list of compatible proxies to add them to your registry. 5. Click **Save** to save the configuration.

UPSTREAM PROXY CACHING

If a Go module isn’t found in your Harness registry, the upstream proxy fetches it from an external registry like proxy.golang.org, reducing duplication and improving module resolution.


Publish & Install Go modules

Authenticate the Go client

  1. In your Harness Go Artifact Registry, click Setup Client.

  2. Click Generate Token to generate an identity token.

  3. Export your token with the following command:

Publish a Go package

  • Run the following command (using Harness CLI) from your project’s root directory to publish your Go package into your Harness Registry:

Install a Go package

  • Install your package using go get:


Troubleshooting

  • Slow downloads or timeouts. Verify network egress to the Harness endpoint. If needed, configure GOPROXY explicitly and ensure your client respects it.

  • Authentication errors. Ensure your go env -w GOPRIVATE and token setup are correctly applied.

  • Package not found. Confirm the package was published to the correct Harness registry and that the version tag exists in the repository.

Last updated

Was this helpful?