Skip to Content
SDKGo

The github.com/canarygate/sdk-go module is the official client for integrating CanaryGate into Go applications.

Compatibility

EnvironmentSupport
Go 1.21+Yes
Linux, macOS, WindowsYes

The SDK fetches flags via a snapshot request (/sdk/flags) and optionally keeps them in sync with the server through SSE streaming when Stream is enabled.

Installation

go get github.com/canarygate/sdk-go

Full API

MethodDescription
New(apiKey, Options)Creates the client
Init() errorLoads flags via snapshot; starts SSE when Stream is enabled
GetFlag(key, ctx)Returns *FlagData or nil
GetFlags(ctx)Returns []FlagData (all flags)
IsStale()true if the connection is degraded
GetLastSyncAt()*string of the last sync
Disconnect()Closes the stream connection (if any) and releases resources

Next steps

Last updated on