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
-
Complete the setup steps to generate a valid API bearer token and publish at least one entity to your environment.
-
Download the latest version of Go.
-
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:
-
Create a new folder for your project, then navigate into the new folder:
mkdir lattice-sdk-go
cd lattice-sdk-go -
Turn on dependency tracking using
go mod init
. For this example, you can useexample/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
-
Create a new file called
lattice.go
. For now, you can leavelattice.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:
-
Install the latest version of the SDK:
go get github.com/anduril/lattice-sdk-go
-
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
- Start building and publishing entities into Lattice.
- Learn how to watch entities, stream specific components, and apply filters.
- See the Lattice sample applications.