Skip to main content

Use the Lattice SDK for gRPC in Go

This page shows you how to set up the Lattice SDK for gRPC in Go and make a request.

Click to go to the gRPC SDK repository. By downloading and/or using, you agree to the terms of use. If you do not agree, do not use the SDK.

Before you begin

  1. Complete the setup steps to generate a valid API bearer token and publish at least one entity to your environment.

  2. Download the latest version of Go.

  3. Verify the installation:

    go --version

If successful, this command prints the Go version.

go version go version go<var>1.23.4</var> darwin/arm64

Set up your project

To create a new Go project, do the following:

  1. Create a new folder for your project, then navigate into the new folder:

    mkdir lattice-sdk-go
    cd lattice-sdk-go
  2. Turn on dependency tracking using go mod init. For this example, you can use example/lattice-sdk-go as your module path. In production you typically set your module path to be the repository where you store, and manage, your project source code:

    go mod init example/lattice-sdk-go
  3. Create a new file called lattice.go. For now, you can leave lattice.go blank. In the following steps, you will paste your starter code in this file.

Install the SDK

To install the gRPC SDK in Go, do the following:

  1. Install the latest version of the SDK:

    go get github.com/anduril/lattice-sdk-go
  2. Fetch the following gRPC dependencies. In a production environment, might need additional dependencies to implement your use-case.

    go get google.golang.org/grpc
    go get google.golang.org/grpc/credentials

Your project structure should now look similar to the following:

├── go.mod
├── go.sum
└── main.go

What's next