# Go quickstart

## 1. Install `hypertune-go-gen`

Once you have a Go application ready, install the `hypertune-go-gen` tool by running:

```bash
go get -tool github.com/hypertunehq/hypertune-go/cmd/hypertune-go-gen
```

## 2. Generate the client

Set the `HYPERTUNE_TOKEN` environment variable to your project token which you can find in the Settings tab of your project.

Then generate the client by running:

```bash
go tool hypertune-go-gen --token=${HYPERTUNE_TOKEN} --outputFileDir=pkg/hypertune
```

Alternatively, you can add the following `go generate` directive to one of your Go files to automatically re-generate the client when you run `go generate ./...`:

```go
//go:generate go tool hypertune-go-gen --token=${HYPERTUNE_TOKEN} --outputFileDir=pkg/hypertune
```

## 3. Use the client

Instantiate the client and evaluate your flags:

<pre class="language-go"><code class="lang-go"><strong>package main
</strong>
import (
	"fmt"
	"log"
	"os"

	// Update to your project path.
	"github.com/myTeam/myProject/pkg/hypertune"
)

func main() {
	if err := run(); err != nil {
		log.Fatal(err)
	}
}

func run() error {
 	var token = os.Getenv("HYPERTUNE_TOKEN")
	source, err := hypertune.CreateSource(&#x26;token)
	if err != nil {
		return err
	}
	defer source.Close()

	source.WaitForInitialization()

	rootNode := source.Root(hypertune.RootArgs{
		Context: hypertune.Context{
			Environment: hypertune.Development,
			User: hypertune.User{
				Id:    "test_id",
				Name:  "Test",
				Email: "hi@test.com",
			},
		},
	})

	fmt.Printf("ExampleFlag: %v\n", rootNode.ExampleFlag(false))

	return nil
}
</code></pre>

## Next steps

Now you can update the logic for `ExampleFlag` from the Hypertune UI without updating your code or waiting for a new build, deployment, app release, or service restart.

To add a new flag, create it in the Hypertune UI then regenerate the client.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hypertune.com/getting-started/go-quickstart.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
