Skip to content

ff4go is a simple and lightweight feature flag solution 100% Open Source.

License

Notifications You must be signed in to change notification settings

dorianneto/ff4go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub Actions Workflow Status Go Report Card GitHub go.mod Go version GitHub License

Thank you for using ff4go! Feel free to report any issue or improvement 🙏

Documentation

https://pkg.go.dev/github.com/dorianneto/ff4go#section-documentation

Demo

First, you need to install the dependency

go get github.com/dorianneto/ff4go

Once the dependency is installed, you can use it like this:

package main

import (
	"fmt"

	"github.com/dorianneto/ff4go"
)

func main() {
	m, err := ff4go.NewManager([]byte(`{"flags":[{"name":"new-ui","enabled":true,"rules":{"users":["user1"],"environments":["development"]}}]}`))
	if err != nil {
		panic(err)
	}

	fmt.Println(m.IsEnabled("new-ui"))                          // true
	fmt.Println(m.IsEnabledForUser("new-ui", "user1"))          // true
	fmt.Println(m.IsEnabledForEnvironment("new-ui", "staging")) // false
}

SDK

Language SDK
Go ff4go
Typescript coming soon

License

MIT