main | development | Go Report Card |
---|---|---|
The Unlaunch Go SDK provides a Go API to access Unlaunch feature flags and other features. Using the SDK, you can easily build Java applications that can evaluate feature flags, dynamic configurations, and more.
- To create feature flags to use with Java SDK, login to your Unlaunch Console at https://app.unlaunch.io
- Official Guide
- Documentation
- Example Project
Here is a simple example.
Run go get github.com/unlaunch/go-sdk
add it to your go.mod
file.
package main
import (
"fmt"
"time"
"github.com/unlaunch/go-sdk/unlaunchio/client"
)
func main() {
config := client.DefaultConfig()
factory, err := client.NewUnlaunchClientFactory("YOUR_SERVER_KEY", config)
if err != nil {
fmt.Printf("Error initializing Unlaunch client %s\n", err)
return
}
unlaunchClient := factory.Client()
if err = unlaunchClient.AwaitUntilReady(3 * time.Second); err != nil {
fmt.Printf("Unlaunch Client wasn't ready %s\n", err)
}
variation := unlaunchClient.Variation("FLAG_KEY", "USER_ID_123", nil)
if variation == "on" {
// show feature
} else {
// don't show feature
}
}
You can start the SDK in offline mode for testing purposes. In offline mode, flags aren't downloaded from the server and no data is sent. All calls to Variation
or its variants will return control
. Read more in the official guide.
To set offline mode :
config := client.DefaultConfig()
config.OfflineMode = true
To run all tests
go test ./...
Create a new tag on GitHub in the following format vx.y.z e.g. v0.0.1
If you run into any problems, bugs, or have any questions or feedback, please report them using the issues feature. We'll respond to all issues usually within 24 to 48 hours.
Please see CONTRIBUTING to find how you can contribute.
Licensed under the Apache License, Version 2.0. See: Apache License.
Unlaunch is a Feature Release Platform for engineering teams. Our mission is allow engineering teams of all sizes to release features safely and quickly to delight their customers. To learn more about Unlaunch, please visit unlaunch.io. You can sign up to get started for free at https://app.unlaunch.io/signup.