1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-04-10 01:16:39 +02:00
unleash.unleash/frontend/src/component/onboarding/dialog/snippets/go.md
Jaanus Sellin b73c283e6c
feat: now code examples are joined into one (#8284)
Joined all examples into one copyable example.

Did not do following ones, because they are using templates and probably
will not work as joined.

1. React
2. Svelte
3. Vue

Also skipped, because those examples are not final yet.

1. .NET
2. Android



![image](https://github.com/user-attachments/assets/c8dabed4-21d0-4af9-900f-e77c5d069fe1)
2024-09-27 10:28:12 +03:00

636 B

1. Install the SDK

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

2. Run Unleash

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

func init() {
    unleash.Initialize(
        unleash.WithListener(&unleash.DebugListener{}),
        unleash.WithAppName("unleash-onboarding-golang"),
        unleash.WithUrl("<YOUR_API_URL>"),
        unleash.WithCustomHeaders(http.Header{"Authorization": {"<YOUR_API_TOKEN>"}}),
        unleash.WithMetricsInterval(5*time.Second),
    )
}

func main() {
    for {
        unleash.IsEnabled("<YOUR_FLAG>")
        time.Sleep(time.Second)
    }
}