Product Updates
Platform

Go (Golang) SDK for Feature Flagging and Experimentation

Go (Golang) SDK for Feature Flagging and Experimentation

We’ve recently released an SDK for our feature flagging and experimentation platform in Go. The library is extremely lightweight, fast and has no external dependenciees- you can use it entirely stands- you can use it entirely stand alone or integrated with our platform. It allows you to easily do feature flagging, variation assignment, and user targeting

Installation is easy:

go get github.com/growthbook/growthbook-golang

Here are some simple examples of how you can use it:

// Parse feature definitions JSON (from GrowthBook API)
features := growthbook.ParseFeatureMap(jsonBody)

// Create context and main GrowthBook object.
context := growthbook.NewContext().WithFeatures(features)
gb := growthbook.New(context)

// Simple boolean (on/off) feature flag
if gb.Feature("my-feature").On {
  // show the feature
}

// Get the value of a non-boolean feature with a fallback
color := gb.Feature("signup-button-color").GetValueWithDefault("blue")
fmt.Println(color)

There are many more use cases that you can read about in our docs. As with all our SDKs, you can use them by themselves to help with feature flag rule evaluation or variation assignment, but the real value comes when you pair them with the GrowthBook API so that you can adjust the values in the JSON payload directly from the UI. For more information, please check out the Go library on GitHub or our full platform.

Table of Contents

Related Articles

See all articles
Experiments
Platform
How Khan Academy Optimizes AI Tutoring with Experimentation
Releases
Product Updates
4.3
Announcing GrowthBook 4.3: Faster Experiments, Deeper Insights
Experiments
Platform
7 Steps to Better Experiment Design

Ready to ship faster?

No credit card required. Start with feature flags, experimentation, and product analytics—free.