This is the Golang implementation of OpenFeature, a vendor-agnostic abstraction library for evaluating feature flags.
We support multiple data types for flags (floats, integers, strings, booleans, objects) as well as hooks, which can alter the lifecycle of a flag evaluation.
go get github.com/open-feature/golang-sdk
To configure the sdk you'll need to add a provider to the openfeature
global singleton. From there, you can generate a Client
which is usable by your code.
While you'll likely want a provider for your specific backend, we've provided a NoopProvider
, which simply returns the default passed in.
package main
import (
"github.com/open-feature/golang-sdk/pkg/openfeature"
)
func main() {
openfeature.SetProvider(openfeature.NoopProvider{})
client := openfeature.GetClient("app")
value, err := client.BooleanValue("v2_enabled", false, nil)
}
Install dependencies with go get ./...
We value having as few runtime dependencies as possible. The addition of any dependencies requires careful consideration and review.
Run tests with make test
.
We hold regular meetings which you can see here.
We are also present in the #openfeature
channel in the CNCF slack.
Thanks so much to our contributors.
Made with contrib.rocks.
Apache License 2.0