Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
github.com/Unleash/unleash-client-go
Unleash Client for Go. Read more about the Unleash project
NOTE The following instructions are for the v2 client which does not work with the latest
version of the Unleash Server (v3) unless legacy routes are enabled. It is recommended that you
use the v3
branch:
go get github.com/Unleash/unleash-client-go/v3
import (
"github.com/Unleash/unleash-client-go/v3"
)
go get github.com/Unleash/unleash-client-go
The easiest way to get started with Unleash is to initialize it early in your application code:
import (
"github.com/Unleash/unleash-client-go"
)
func init() {
unleash.Initialize(
unleash.WithListener(&unleash.DebugListener{}),
unleash.WithAppName("my-application"),
unleash.WithUrl("http://unleash.herokuapp.com/api/"),
)
}
After you have initialized the unleash-client you can easily check if a feature toggle is enabled or not.
unleash.IsEnabled("app.ToggleX")
To shut down the client (turn off the polling) you can simply call the destroy-method. This is typically not required.
unleash.Close()
The Go client comes with implementations for the built-in activation strategies provided by unleash.
Read more about the strategies in activation-strategy.md.
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))
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).
Requirements:
Run tests:
make
Run lint check:
make lint
Run code-style checks:(currently failing)
make strict-check
Run race-tests(currently failing):
make test-all
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.