All Projects → Unleash → Unleash Client Go

Unleash / Unleash Client Go

Licence: apache-2.0
Unleash Client for Go

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Unleash Client Go

Unleash
Unleash is the open source feature toggle service.
Stars: ✭ 4,679 (+5898.72%)
Mutual labels:  feature-flags, feature-toggles, feature
jest-launchdarkly-mock
Easily unit test LaunchDarkly feature flagged components with jest
Stars: ✭ 14 (-82.05%)
Mutual labels:  feature-flags, feature-toggles, feature
ld-redux
A library to integrate launch darkly with react redux
Stars: ✭ 33 (-57.69%)
Mutual labels:  feature-flags, feature-toggles, feature
Flagception Bundle
Feature flags on steroids!
Stars: ✭ 162 (+107.69%)
Mutual labels:  feature-flags, feature-toggles, feature
Flipper
🐬 Beautiful, performant feature flags for Ruby.
Stars: ✭ 2,732 (+3402.56%)
Mutual labels:  feature-flags, feature-toggles, feature
ld-scheduler
Schedule Launch Darkly flags on or off
Stars: ✭ 14 (-82.05%)
Mutual labels:  feature-flags, feature-toggles, feature
unleash-client-java
Unleash client SDK for Java
Stars: ✭ 86 (+10.26%)
Mutual labels:  feature-flags, feature-toggles, feature
Featuretoggle
Simple, reliable feature toggles in .NET
Stars: ✭ 641 (+721.79%)
Mutual labels:  feature-flags, feature-toggles
toggler
toggler is a feature flag service to decouple deployment, feature enrollment and experiments
Stars: ✭ 27 (-65.38%)
Mutual labels:  feature-flags, feature-toggles
react-client-sdk
LaunchDarkly Client-side SDK for React.js
Stars: ✭ 42 (-46.15%)
Mutual labels:  feature-flags, feature-toggles
Javascript Client
NodeJS and Browser SDK client for Split Software
Stars: ✭ 30 (-61.54%)
Mutual labels:  feature-flags, feature-toggles
ruby-server-sdk
LaunchDarkly Server-side SDK for Ruby
Stars: ✭ 25 (-67.95%)
Mutual labels:  feature-flags, feature-toggles
erlang-server-sdk
LaunchDarkly Server-Side SDK for Erlang/Elixir
Stars: ✭ 16 (-79.49%)
Mutual labels:  feature-flags, feature-toggles
ios-client-sdk
LaunchDarkly Client-side SDK for iOS (Swift and Obj-C)
Stars: ✭ 45 (-42.31%)
Mutual labels:  feature-flags, feature-toggles
Flipper
Flipper is a simple and useful tool to deal with feature toggles
Stars: ✭ 64 (-17.95%)
Mutual labels:  feature-flags, feature-toggles
Fun with flags
Feature Flags/Toggles for Elixir
Stars: ✭ 554 (+610.26%)
Mutual labels:  feature-flags, feature-toggles
featurehub
FeatureHub - cloud native feature flags, A/B testing and remote configuration service. Real-time streaming feature updates. Provided with Java, JavaScript, Go, .Net, Android and Flutter SDKs.
Stars: ✭ 136 (+74.36%)
Mutual labels:  feature-flags, feature-toggles
python-client
Python SDK client for Split Software
Stars: ✭ 12 (-84.62%)
Mutual labels:  feature-flags, feature-toggles
Flags
⛳️ Feature Flags for Next.js
Stars: ✭ 277 (+255.13%)
Mutual labels:  feature-flags, feature-toggles
Unleash Client Python
Unleash client for Python 💡💡💡
Stars: ✭ 44 (-43.59%)
Mutual labels:  feature-flags, feature-toggles

Build Status GoDoc Go Report Card

unleash-client-go

Unleash Client for Go. Read more about the Unleash project

Version 3.x of the client requires unleash-server v3.x or higher.

Go Version

The client is currently tested against Go 1.10.x and 1.13.x. These versions will be updated as new versions of Go are released.

The client may work on older versions of Go as well, but are not actively tested.

Getting started

1. Install unleash-client-go

To install the latest version of the client use:

go get github.com/Unleash/unleash-client-go/v3

If you are still using Unleash Server v2.x.x, then you should use:

go get github.com/Unleash/unleash-client-go

2. Initialize unleash

The easiest way to get started with Unleash is to initialize it early in your application code:

import (
	"github.com/Unleash/unleash-client-go/v3"
)

func init() {
	unleash.Initialize(
		unleash.WithListener(&unleash.DebugListener{}),
		unleash.WithAppName("my-application"),
		unleash.WithUrl("http://unleash.herokuapp.com/api/"),
	)
}

3. Use unleash

After you have initialized the unleash-client you can easily check if a feature toggle is enabled or not.

unleash.IsEnabled("app.ToggleX")

4. Stop unleash

To shut down the client (turn off the polling) you can simply call the destroy-method. This is typically not required.

unleash.Close()

Built in activation strategies

The Go client comes with implementations for the built-in activation strategies provided by unleash.

  • DefaultStrategy
  • UserIdStrategy
  • FlexibleRolloutStrategy
  • GradualRolloutUserIdStrategy
  • GradualRolloutSessionIdStrategy
  • GradualRolloutRandomStrategy
  • RemoteAddressStrategy
  • ApplicationHostnameStrategy

Read more about the strategies in activation-strategy.md.

Unleash context

In order to use some of the common activation strategies you must provide a unleash-context. This client SDK allows you to send in the unleash context as part of the isEnabled call:

ctx := context.Context{
    UserId: "123",
    SessionId: "some-session-id",
    RemoteAddress: "127.0.0.1",
}

unleash.IsEnabled("someToggle", unleash.WithContext(ctx))

Caveat

This client uses go routines to report several events and doesn't drain the channel by default. So you need to either register a listener using WithListener or drain the channel "manually" (demonstrated in this example).

Development

Adding client specifications

In order to make sure the unleash clients uphold their contract, we have defined a set of client specifications that define this contract. These are used to make sure that each unleash client at any time adhere to the contract, and define a set of functionality that is core to unleash. You can view the client specifications here.

In order to make the tests run please do the following steps.

// in repository root
// testdata is gitignored
mkdir testdata
cd testdata
git clone https://github.com/Unleash/client-specification.git

Requirements:

  • make
  • golint (go get -u golang.org/x/lint/golint)

Run tests:

make

Run lint check:

make lint

Run code-style checks:(currently failing)

make strict-check

Run race-tests:

make test-all
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].