go-sdk evaluates flags locally, against a Configuration it caches in-process and refreshes on an interval. There's no network round trip on the evaluation hot path, and if the platform is briefly unreachable, the SDK keeps serving the last-known-good Configuration instead of failing evaluations. This is the same design js-sdk uses on the Node.js side, and both are checked against the same bucketing fixture so a subject gets the same variation regardless of which SDK evaluated it.
Install and construct a client
go get github.com/rollfuse/go-sdk
import growthops "github.com/rollfuse/go-sdk"
client, err := growthops.NewClient(baseURL, credential)
if err != nil {
log.Fatal(err)
}
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
if err := client.Start(ctx); err != nil {
log.Printf("initial config fetch did not complete: %v", err)
}
NewClient takes your Environment's base URL and a Service Credential (created from the console's Credentials screen, shown in plaintext exactly once). Start blocks until the first Configuration fetch succeeds or the passed context is done; a service that can't afford to block calls Start in a goroutine and relies on Evaluate's fallback option until the first fetch lands.
Evaluate a flag
result, err := client.Evaluate(subjectKey, "checkout-redesign",
growthops.WithAttributes(map[string]string{"plan": "growth"}),
growthops.WithDefault(false),
)
if err != nil {
// network/config error: result still carries the fallback value
}
if result.Value == "true" {
// serve the new checkout
}
Evaluate is synchronous and never makes a network call itself: it reads the cached Configuration (behind an atomic pointer swap, so concurrent evaluations from many goroutines never block on a lock) and applies the same rule-matching and percentage-bucketing logic the API and js-sdk both use. If no Configuration has loaded yet, or the flag key doesn't exist, Evaluate returns your supplied default rather than an error your request path has to special-case.
Configuration options
NewClient takes functional options for everything beyond the required baseURL and credential: WithRefreshInterval, WithMaxConfigAge (how stale a cached Configuration is allowed to get before evaluations fall back to defaults instead of trusting it), and callback hooks (WithOnConfigRefreshed, WithOnConfigRefreshError) for wiring evaluation health into your own logging or metrics.
Exposure reporting
A rule-matched evaluation is queued and reported asynchronously via POST /v1/exposure-events. This never blocks Evaluate, and a full queue drops the oldest entry rather than back-pressuring your request path. Call client.Close() on shutdown to flush what's queued before your process exits.
See the go-sdk repository for the full API reference, and examples-go-prometheus for a runnable service wiring this into a real deploy.