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

# Set up Go SDK

<View title="Developer" />

<View title="Federal docs" />

<View title="EU docs" />

<View title="Federal docs">
  <Danger>
    **LaunchDarkly onboarding is not available in federal environments**

    To learn more, read <a href="/docs/home/infrastructure/federal">LaunchDarkly in federal environments</a>.
  </Danger>
</View>

Install and initialize the LaunchDarkly Go SDK to start evaluating feature flags in your application.

## Install the package

<ul>
  <li>
    If you are using the standard `Go` modules system, import the SDK packages in your code and `go build` will
    automatically download them. The SDK and its dependencies are modules.
  </li>

  <li>Alternatively, you can run the following command:</li>
</ul>

```shell title="Shell" lines wrap theme={null}
go get github.com/launchdarkly/go-server-sdk/v7
```

### Initialize the SDK

```go title="Go SDK initialization" expandable lines wrap theme={null}
package main

import (
	"fmt"
	"os"
	"time"

	ld "github.com/launchdarkly/go-server-sdk/v7"
)

func main() {
	// This is your LaunchDarkly SDK key.
	// Never hardcode your SDK key in production.
	ldClient, _ := ld.MakeClient("YOUR_SDK_KEY", 5*time.Second)
	if ldClient.Initialized() {
		fmt.Printf("SDK successfully initialized!")
	} else {
		fmt.Printf("SDK failed to initialize")
		os.Exit(1)
	}

	// For onboarding purposes only we flush events as soon as
	// possible so we quickly detect your connection.
	// You don't have to do this in practice because events are automatically flushed.
	ldClient.Flush()
}
```

<Accordion title="Finding your SDK credentials">
  You can find your server-side SDK keys, mobile keys, and client-side ID on the **SDK keys** page under **Settings**.
</Accordion>

To learn more, read [Initialize the client](/docs/sdk/server-side/go#initialize-the-client) in the Go SDK reference guide.
