> ## Documentation Index
> Fetch the complete documentation index at: https://confidence.spotify.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Go

> Confidence Go SDK for server-side feature flag evaluation.

The Confidence Go SDK provides ultra-low latency feature flag evaluation for Go applications using the [Confidence Resolver](https://github.com/spotify/confidence-resolver)—a Rust-based resolver that runs natively or as WebAssembly.

## Features

* **Local evaluation**: Flag rules evaluate on your infrastructure in microseconds
* **OpenFeature compatible**: Standard feature flag API through OpenFeature provider
* **Background sync**: Flag rules and logging sync with Confidence in the background
* **High reliability**: No network dependency at evaluation time

## Installation

```bash theme={null}
go get github.com/spotify/confidence-resolver/openfeature-provider/go
go mod tidy
```

## Quickstart

```go theme={null}
package main

import (
    "context"
    "log"

    "github.com/open-feature/go-sdk/openfeature"
    "github.com/spotify/confidence-resolver/openfeature-provider/go/confidence"
)

func main() {
    ctx := context.Background()

    // Initialize the Confidence provider
    provider, err := confidence.NewProvider(ctx, confidence.ProviderConfig{
        ClientSecret: "your-client-secret",
    })
    if err != nil {
        log.Fatalf("Failed to create provider: %v", err)
    }

    // Register with OpenFeature
    openfeature.SetProviderAndWait(provider)
    client := openfeature.NewClient("my-app")

    // Evaluate a flag
    evalCtx := openfeature.NewEvaluationContext("user-123", map[string]interface{}{
        "country": "US",
    })

    value, err := client.BooleanValue(ctx, "my-feature-flag.enabled", false, evalCtx)
    if err != nil {
        log.Printf("Flag evaluation failed: %v", err)
    }
    log.Printf("Flag value: %v", value)
}
```

## Resources

<CardGroup cols={2}>
  <Card title="GitHub repository" icon="github" href="https://github.com/spotify/confidence-resolver/tree/main/openfeature-provider/go">
    Source code and examples
  </Card>

  <Card title="OpenFeature Go SDK" icon="flag" href="https://openfeature.dev/docs/reference/technologies/server/go">
    OpenFeature documentation
  </Card>

  <Card title="Context" icon="sliders" href="/docs/sdks/context">
    Configure evaluation context
  </Card>

  <Card title="Apply events" icon="chart-line" href="/docs/sdks/apply-event">
    Understand flag assignment tracking
  </Card>
</CardGroup>
