announcements

Introducing the Zenmanage Go SDK

The Zenmanage Go SDK brings feature flags to Go services with context-aware evaluation, fast local rule caching, and middleware for net/http, Gin, and Echo.

The Zenmanage Go SDK makes it simple to add feature flags to your Go services. Local rule caching keeps evaluation fast, context-based targeting handles per-request rollouts, and middleware for net/http, Gin, and Echo wires flags straight into request handling.

Go is the latest server-side SDK in the series we have been shipping this quarter, following Python and JavaScript. If you have been running Go services against the REST API directly, or waiting on a native client before adopting Zenmanage, this is it.

Why Go?

Go is the default choice for a lot of cloud-native infrastructure — API gateways, service meshes, background workers, and the microservices sitting behind them. Those systems tend to be latency-sensitive and horizontally scaled, which makes an HTTP round trip on every flag check a bad trade. The Zenmanage Go SDK evaluates flags against a locally cached rule set instead, so a service can check a flag on every request without adding a network call to the critical path.

Key features

Fast local evaluation

Rules are fetched once and cached — in memory or on the filesystem — so evaluation happens against local state instead of a remote call. In a Go service handling thousands of requests per second, that is the difference between a flag check being free and a flag check being a bottleneck.

Context-aware targeting

Pass a context built from a user ID, org, plan, region, or any attribute your targeting rules key off of, and the SDK resolves the correct value for boolean, string, and numeric flags. Deterministic bucketing means a given context lands in the same rollout bucket every time — ramping from 5% to 50% to 100% does not reshuffle who is already in.

Middleware for net/http, Gin, and Echo

A separate middleware package injects a configured client into the request lifecycle for the standard library's net/http, Gin, and Echo, and can build a user context automatically from a request header. Handlers call IsEnabled directly instead of threading a client through by hand.

Defensive by default

GetString, GetNumber, and the fluent Flags().Single() all take an inline default, and errors are typed so you can distinguish a missing flag from a failed rules fetch with errors.As. Catch the error from any evaluation call, including IsEnabled, and fall back to a safe value instead of failing the request.

Getting started

Install from the Go module registry:

go get github.com/zenmanage/zenmanage-go

Configure a client and evaluate a flag:

cfg, err := zenmanage.NewConfigBuilder().
    WithEnvironmentToken("srv_your_server_key_here").
    Build()
if err != nil {
    log.Fatal(err)
}

client := zenmanage.New(cfg)

enabled, err := client.IsEnabled(context.Background(), "new-dashboard", "user-123")
if err != nil {
    log.Println("evaluation failed, defaulting to disabled:", err)
    enabled = false
}
fmt.Println("enabled:", enabled)

Drop that same client into an existing net/http server with the middleware package:

import "github.com/zenmanage/zenmanage-go/middleware"

mux := http.NewServeMux()
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
    enabled, err := middleware.IsEnabled(r.Context(), "new-feature")
    // ...
})
http.ListenAndServe(":8080", middleware.InjectFlags(client, mux))

Gin and Echo integrations follow the same pattern via middleware/gin and middleware/echo submodules — install the one you need and call InjectFlags as middleware, then IsEnabled inside your handlers.

What's next

The Go SDK is a server-side client — it requires a server token (prefixed srv_), the same key requirement as the PHP core SDK. More language releases are coming this quarter. The Go SDK is available on the Go module registry now, source lives on GitHub, and the developer docs have the full quickstart and API reference.

Enjoyed this article?

Share it with your network.