Skip to content

Flags

The Go SDK provides two surfaces for FlowCatalyst feature flags:

  1. Definition sync (pkg/fcsdk/sync): declare BOOL and closed ENUM flags alongside roles, event types and subscriptions in a sync.DefinitionSet.
  2. Runtime resource client (pkg/fcsdk/flags): fetch conditional snapshots (ETag / 304 Not Modified), open the SSE watch stream, and manage delegated client overrides with X-On-Behalf-Of.

If your service uses the Go application framework, prefer Platform flags (flowcatalyst.PlatformFlags + go/flags), which wraps this wire protocol with an atomic in-memory snapshot evaluator, health check, metrics and flagsadmin.

set := sync.ForApplication("orders").
AddFeatureFlag(sync.MakeBoolFlag("checkout.express", false).
WithDescription("Enable one-click express checkout").
WithLifecycle("RELEASE").
WithGovernance("CLIENT_MANAGED").
WithExposeToClient(true).
WithReviewAfter("2026-12-31")).
AddFeatureFlag(sync.MakeEnumFlag("routing.engine", []string{"standard", "fast"}, "standard").
WithDescription("Route calculation engine").
WithLifecycle("EXPERIMENT").
WithGovernance("OPERATORS_ONLY"))
res := sync.NewSynchronizer(fcClient).Sync(ctx, set, sync.DefaultOptions())
flagsClient := flags.New(fcClient)
// Conditional snapshot fetch (returns changed=false on 304 Not Modified)
snap, changed, err := flagsClient.FetchSnapshot(ctx, "orders", currentRevision)
if err != nil {
return err
}
if changed {
currentRevision = snap.Revision
// update local cache
}
// Subscribe to live revision invalidations over SSE
err = flagsClient.Watch(ctx, "orders", func(revision string) {
// trigger conditional FetchSnapshot refresh
})
oboCtx := client.WithOnBehalfOf(ctx, actingPrincipalID)
_, err := flagsClient.SetClientOverride(oboCtx, "orders", "checkout.express", "acme",
&flags.SetClientOverrideRequest{Value: false})
err = flagsClient.DeleteClientOverride(oboCtx, "orders", "checkout.express", "acme")

Note that SetClientOverrideRequest uses explicit JSON marshalling so setting Value to false is always transmitted rather than omitted.