We've built a simple console application that demonstrates how LaunchDarkly's SDK works.
Below, you'll find the basic build procedure, but for more comprehensive instructions, you can visit your Quickstart page or the Go SDK reference guide.
This demo requires Go 1.14 or higher.
- Edit
main.go
and set the value ofsdkKey
to your LaunchDarkly SDK key. If there is an existing boolean feature flag in your LaunchDarkly project that you want to evaluate, setfeatureFlagKey
to the flag key.
const sdkKey = "1234567890abcdef"
const featureFlagKey = "my-flag"
-
On the command line, run
go build
-
Run
./hello-go
You should see the message "Feature flag '<flag key>' is <true/false> for this user"
.