What is feature flag?
There is a post by Martin Fowler on feature flag, and can be found here.
In our last post: Self-Updating binaries for Go, we utilized the github platform to add a functionality in our go application for self update, and today, we will add one more tool in our arsenal of using powerful
feature-flags by storing a file in github-repo.
Problem statement: Now, we have developed an application with rich of features, however, we want to test new features for a specific set of users before rolling out for everyone.
How to use the go-feature-flag?
- Let’s start with an empty project. Source code for the project
GitHub - sarvsav/golang-tag-example at go_feature_flag_example
An example repo that demonstrates how tagging works in golang and github This repo is a demonstration on how to use…
2. Initialize the go-feature-flag module using the below command:
go get github.com/thomaspoignant/go-feature-flag
3. Now, we need a github repo to host the flag file, which sets the feature values to enable or disable for the set of users. Below is an example of the sample flag YAML file
- query: admin eq true
The code for whole repository can be download from here: