Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
G

go-feature-flag

> DevOps
Open source

GO Feature Flag is a simple, complete and lightweight self-hosted cloud native feature flag solution 100% Open Source — built on OpenFeature ️

2.1K stars0 likes0 views
WebsiteGitHub

About

GO Feature Flag is a simple, complete and lightweight self-hosted cloud native feature flag solution 100% Open Source — built on OpenFeature ️

️ GO Feature Flag


<a href="https://github.com/avelino/awesome-go/#server-applications"></a>
<a href="https://gofeatureflag.org/slack"></a>
<a href="https://github.com/sponsors/thomaspoignant"></a>
<br />
<a href="https://gofeatureflag.org">GO Feature Flag is a simple, complete and lightweight self-hosted cloud native feature flag solution 100% Open Source. ️</a>

:pray: If you are using GO Feature Flag please consider to add yourself in the adopters list.
This simple act significantly boosts the project's visibility and credibility, making a substantial contribution to its advancement.

If you want to support me and GO Feature Flag, you can also become a sponsor.

Table of Contents

  • ️ GO Feature Flag
    • Table of Contents
    • What is GO Feature Flag?
    • What can I do with GO Feature Flag?
    • Part of the OpenFeature Ecosystem
    • Getting started
      • Create a feature flag configuration
      • Create a relay proxy configuration file
      • Install the relay proxy
      • Use Open Feature SDK
        • Install dependencies
        • Init your Open Feature client
        • Evaluate your flag
      • Installation
      • Create a feature flag configuration
      • SDK Initialisation
      • Evaluate your flags
    • Can I use GO Feature Flag with any language?
    • Where do I store my flags file?
    • Flags file format
    • Rule format
      • Examples
    • Evaluation Context
    • Custom bucketing
    • Variations
      • Example
    • Rollout
      • Complex rollout strategy available
    • Notifiers
    • Export data
    • Cli
  • How can I contribute?
    • Contributors
    • Sponsors
    • Adopters

What is GO Feature Flag?

GO Feature Flag is a lightweight and open-source solution that provides a simple and complete feature flag implementation.

The solution has been built to facilitate the usage of feature flags in your code with the easiest setup possible.

Originally, GO Feature Flag was designed as a solution exclusively for the GO language. With the new standardization of feature flags by the Openfeature project, the solution is now available for multiple languages (list of supported languages) through a simple API server called the relay proxy, which can be hosted.

[!TIP] If you are not familiar with feature flags, I've written an article which explains why feature flags can fasten your iteration cycle.

What can I do with GO Feature Flag?

  • Use the feature flag standard OpenFeature in your favorite language (see list).
  • Storing your configuration flags file on various locations (HTTP, S3, Kubernetes, see full list).
  • Configuring your flags in various format (JSON, TOML and YAML).
  • Adding complex rules to target your users.
  • Use a complex rollout strategy for your flags :
    • Run A/B testing experimentation.
    • Progressively rollout a feature.
    • Schedule your flag updates.
  • Exporting your flags usage data to various destinations such as (S3, Google cloud storage, file, Kafka, see the full list).
  • Getting notified when a flag has been changed (webhook and slack).
  • Support your full stack, from the backend to the frontend including your mobile apps.

https://github.com/user-attachments/assets/56e1a2a2-996f-4db8-9c93-28c057e4ed5a

The code of this demo is available in examples/demo repository.

Part of the OpenFeature Ecosystem

At GO Feature Flag, we believe in the power of open standards and, the importance of vendor neutrality. That's why we've chosen to rely on Open Feature for our SDKs.

By adopting GO Feature Flag you embrace the OpenFeature standard and you get all the benefits of the ecosystem.

  • Open-Source standard SDKs
  • No Vendor Lock-In
  • OpenFeature community based support for SDKs

Getting started

[!IMPORTANT] Before starting to use GO Feature Flag you should decide if you want to use Open Feature SDKs or if you want to use GO Feature Flag as a GO Module.

We recommend using the relay-proxy for a central flag management and evaluation solution, it enables the multi-languages support, and it integrates seamlessly with the Open Feature SDKs.
This is the best way to get full potential of GO Feature Flag.

If your project is exclusively in GO, the GO module is an option. It will perform the flag evaluation directly in your GO code.

Using Open Feature SDKs

Create a feature flag configuration

Create a new YAML file containing your first flag configuration.

yaml
# 20% of the users will use the variation "my-new-feature"
test-flag:
  variations:
    my-new-feature: true
    my-old-feature: false
  defaultRule:
    percentage:
      my-new-feature: 20
      my-old-feature: 80

This flag split the usage of this flag, 20% will use the variation my-new-feature and 80% the variation my-old-feature.

Create a relay proxy configuration file

Create a new YAML file containing the configuration of your relay proxy.

yaml
server:
  mode: http
  port: 1031
pollingInterval: 1000
startWithRetrieverError: false
retriever:
  kind: file
  path: /goff/flag-config.yaml
exporter:
  kind: log

Install the relay proxy

And we will run the relay proxy locally to make the API available.
The default port will be 1031.

bash
# Launch the container
docker run \
  -p 1031:1031 \
  -v $(pwd)/flag-config.yaml:/goff/flag-config.yaml \
  -v $(pwd)/goff-proxy.yaml:/goff/goff-proxy.yaml \
  gofeatureflag/go-feature-flag:latest

If you don't want to use docker to install the relay proxy you can follow other ways to install it in the documentation.

Use Open Feature SDK

In this example, we are using the nodejs SDK, but you can check other languages here.

Install dependencies

bash
npm i @openfeature/server-sdk @openfeature/go-feature-flag-provider

Init your Open Feature client

In your app initialization, you have to create a client using the Open Feature SDK and initialize it.

javascript
const {OpenFeature} = require("@openfeature/server-sdk");
const {GoFeatureFlagProvider} = require("@openfeature/go-feature-flag-provider");

// init Open Feature SDK with GO Feature Flag provider
const goFeatureFlagProvider = new GoFeatureFlagProvider({
  endpoint: 'http://localhost:1031/' // DNS of your instance of relay proxy
});
OpenFeature.setProvider(goFeatureFlagProvider);
const featureFlagClient = OpenFeature.getClient('my-app')

Evaluate your flag

Now you can evaluate your flags anywhere in your code using this client.

…

Using the GO Module

Installation

bash
go get github.com/thomaspoignant/go-feature-flag

Create a feature flag configuration

Create a new YAML file containing your first flag configuration.

yaml
# 20% of the users will use the variation "my-new-feature"
test-flag:
  variations:
    my-new-feature: true
    my-old-feature: false
  defaultRule:
    percentage:
      my-new-feature: 20
      my-old-feature: 80

This flag split the usage of this flag, 20% will use the variation my-new-feature and 80% the variation my-old-feature.

SDK Initialisation

First, you need to initialize the ffclient with the location of your backend file.

go
err := ffclient.Init(ffclient.Config{
  PollingInterval: 3 * time.Second,
  Retriever:      &fileretriever.Retriever{
    Path: "flag-config.goff.yaml",
  },
})
defer ffclient.Close()

This example will load a file from your local computer and will refresh the flags every 3 seconds (if you omit the PollingInterval, the default value is 60 seconds).

ℹ info
This is a basic configuration to test locally, in production it is better to use a remote place to store your feature flag configuration file.
Look at the list of available options in the Store your feature flag file page.

Evaluate your flags

Now you can evaluate your flags anywhere in your code.

go
user := ffcontext.NewEvaluationContext("user-unique-key")
hasFlag, _ := ffclient.BoolVariation("test-flag", user, false)
if hasFlag {
  // flag "test-flag" is true for the user
} else {
  // flag "test-flag" is false for the user
}

The full documentation is available on https://docs.gofeatureflag.org
You can find more examples in the examples/ directory.

Can I use GO Feature Flag with any language?

Originally GO Feature Flag was built to be a GOlang only library, but it limits the ecosystem too much.
To be compatible with more languages we have implemented the GO Feature Flag Relay Proxy. It is a service you can host that provides an API to evaluate your flags, you can call it using HTTP to get your variation.

Since we believe in standardization we are also implementing OpenFeature providers to interact with this API in the language of your choice.
_(OpenFeature is still at an early stage, so not all languages are supported

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Gobeginner-friendlycontinuous-deliverycontinuous-deploymentcontinuous-testing

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
CategoryDevOps
PricingOpen source

> Related tools

D
Docker
容器化平台,标准化应用交付
G
GitHub Actions
GitHub 原生 CI/CD 工作流
N
Nginx
高性能 Web 服务器与反向代理