The github.com/canarygate/sdk-go module is the official client for integrating CanaryGate into Go applications.
Compatibility
| Environment | Support |
|---|---|
| Go 1.21+ | Yes |
| Linux, macOS, Windows | Yes |
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-goFull API
| Method | Description |
|---|---|
New(apiKey, Options) | Creates the client |
Init() error | Loads 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