Go
Prerequisites
Ensure you have Go installed and configured on your local machine.
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
Navigate to the Artifact Registry module in your Harness project.
Click on New Artifact Registry.
In the Registry Type list, select Go Registry.
Provide a Registry Name.
The registry name must start with a letter and can include lowercase alphanumeric characters, underscores (
_), periods (.), and hyphens (-).
Optionally, add a Description and Labels for better organization.
Choose visibility between Public and Private.
Click Create Registry to finalize.
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
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.
Publish & Install Go modules
Authenticate the Go client
In your Harness Go Artifact Registry, click Setup Client.
Click Generate Token to generate an identity token.
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
GOPROXYexplicitly and ensure your client respects it.Authentication errors. Ensure your
go env -w GOPRIVATEand 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?