Skip to main content

Overview

This tutorial defines four flags in Go, loads those definitions directly with the CLI, generates typed accessors, and evaluates flags for one user. You need Go 1.23+, Node.js 22.12+ for the CLI, and a shipd account. For a step-by-step first flag, use the quickstart. For the equivalent TypeScript application, see the Node tutorial.

Create the project

Define flags

Create shipd.config.go:
shipd.config.go
The CLI discovers shipd.config.go and selects Go output automatically.

Push and generate accessors

The CLI creates the flags in the selected project and environment, then writes internal/flags/flags_gen.go. Commit that file with shipd.config.go. The generator creates Defaults(), NewCheckout, SearchVariant, MaxRetries, and CheckoutPayload.

Read flags

Create main.go. One client fetches a snapshot, then evaluates every check locally:
main.go

Run

Create a server SDK key for the same environment in the dashboard, then run:
The program logs the checkout, search variant, and retry count, then flushes diagnostic events before closing. If the first snapshot cannot load within five seconds, it logs the error and uses the generated defaults. For a long-running service, reuse the client and pass an EvaluationContext on each request. Polling refreshes the snapshot every 30 seconds by default. Identify queues telemetry; it does not set a global evaluation identity.

Next