Skip to content

GitHub


title: “Go SDK Location” description: “Go SDK Location for Trimble Access Management” lead: "" date: 2023-06-12T13:46:25-06:00 lastmod: 2023-06-12T13:46:25-06:00 draft: false images: [] menu: docs: parent: “go” weight: 332 toc: true

Section titled “title: “Go SDK Location” description: “Go SDK Location for Trimble Access Management” lead: "" date: 2023-06-12T13:46:25-06:00 lastmod: 2023-06-12T13:46:25-06:00 draft: false images: [] menu: docs: parent: “go” weight: 332 toc: true”

The Go SDK can be accessed from the Trimble Access Management Go SDK repository on GitHub. The following sections describe how to gain access to the repository and setup required for resolving the modules via commands such as go get.

Step 1: Get Access to the Trimble GitHub Organization

Section titled “Step 1: Get Access to the Trimble GitHub Organization”

You will need to request access to the Trimble GitHub organization to access the repository. For more information, see the README.

Once you have received access to the organization, follow the Contributor Guidelines to set up a Personal Access Token (PAT) with repository access.

Set the following environment variable:

GOPRIVATE=github.com/trimble-oss/tam-sdk-go

Setting GOPRIVATE to the value above bypasses the public proxy (https://proxy.golang.org/) and checksum database (https://sum.golang.org/) and prevents errors when Go commands try to resolve the private TAM modules via commands such as go mod download.

Step 3: Set Up Git Access to Private Repository

Section titled “Step 3: Set Up Git Access to Private Repository”

Go commands use HTTPS to access remote repositories and will not prompt for a username and password by default. If you have not already set up Git authentication to access the Trimble GitHub organization’s internal or private repositories, you will need to use one of the options in the following sections.

More information on accessing modules from private repositories can be found from the official Go modules reference.

Option 1: Configure Git to use your credentials when accessing the private repository URL

Section titled “Option 1: Configure Git to use your credentials when accessing the private repository URL”

Run the following command:

Terminal window
$ git config --global url."https://<GITHUB_PAT>:x-oauth-basic@github.com/trimble-oss/tam-sdk-go".insteadOf "https://github.com/trimble-oss/tam-sdk-go"

where <GITHUB_PAT> is the Personal Access Token that was set up as part of Step 1.

Option 2: Set the GIT_TERMINAL_PROMPT environment variable

Section titled “Option 2: Set the GIT_TERMINAL_PROMPT environment variable”

Set the following environment variable:

GIT_TERMINAL_PROMPT=1

This allows Go commands to prompt for credentials when attempting to access the private repository containing the TAM modules.

The Go SDK can also be found in Trimble E-Tools Artifactory as part of the trimblecloud-tam-sdk-go-go-local artifact.

In order to resolve the Go SDK modules using Go commands such as go get, you must configure Artifactory and your local Go build environment as described in the following sections.

Artifactory currently supports resolution of modules via a virtual repository. Users will also need to set up their own remote repository to resolve public Go package dependencies. Finally, the GOPROXY environment variable must be set to use Artifactory in order to successfully resolve dependencies.

You will need to submit a Trimble Cloud Support ticket with the category as “E-Tools - Artifactory”. Request the addition of two repositories for your group:

  • A remote Go repository.
  • A virtual Go repository that aggregates the trimblecloud-tam-sdk-go-go-local local repository and the newly-created remote Go repository. This repository is required since Artifactory only supports resolution of Go modules from virtual repositories. For more information, see JFrog Artifactory Documentation

The remote Go repository will delegate to https://proxy.golang.org/, the default proxy hosted by Google, and will serve any public package dependencies. The local repository (trimblecloud-tam-sdk-go-go-local) will serve the private TAM Go SDK modules. The virtual repository aggregates the remote and local repositories and will serve as the endpoint used for the GOPROXY environment variable. This configuration enables Go commands to resolve any public and private modules with Artifactory serving as a cache.

To configure your Go build environment, you will need to set the following environment variables:

GOPROXY=https://<USERNAME>:<API-KEY>@artifactory.trimble.tools/artifactory/<VIRTUAL-REPOSITORY>/
GONOSUMDB=github.com/trimble-oss/tam-sdk-go

where <USERNAME> and <API-KEY> are your Artifactory credentials and <VIRTUAL-REPOSITORY> is the name of the virtual repository that was created in the previous section.

You should now be able to use any Go commands (e.g. go build, go mod tidy, etc.) and the TAM SDK modules will be resolved automatically through Artifactory.

Release history can be found here