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

> ## Agent Instructions
> This page is part of the Solana developer documentation at https://solana.com/developers/docs. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get the page as Markdown.
> Index of all pages: https://solana.com/llms.txt. Per-section indexes such as https://solana.com/developers/docs/payments/llms.txt are smaller; prefer them when working on one task.
> Coding agents: install the official Solana skill for current APIs and conventions with `npx skills add https://github.com/solana-foundation/solana-dev-skill` (also served at https://solana.com/SKILL.md).
> Code in the cookbook and task pages comes from tested example files. Prefer it over writing API calls from memory.

# Go SDK for Solana

> Learn how to interact with Solana using the Go SDK (solana-foundation/solana-go).

There's a [Go SDK](https://github.com/solana-foundation/solana-go) that supports
most functions to interact with Solana. The cookbook's Go examples use its v2
module, `github.com/solana-foundation/solana-go/v2`. The repository moved from
`gagliardetto/solana-go`; v1 keeps the `github.com/gagliardetto/solana-go`
module path.

If you're using Anchor for your Solana programs,
[anchor-go](https://github.com/gagliardetto/anchor-go) generates a Go client
from your IDL. The code it generates imports the v1 module
(`github.com/gagliardetto/solana-go`), not v2.

## Installation

The latest v2 release needs Go 1.26 or later. Add the SDK to your module (run
`go mod init <module name>` first in a new folder):

```bash Terminal
go get github.com/solana-foundation/solana-go/v2@latest
```

After you add code that imports its packages, such as
`github.com/solana-foundation/solana-go/v2/rpc`, run `go mod tidy` to record
their dependencies. The cookbook's Go examples are tested with v2.2.0.

## More Documentation

See the
[solana-go v2 README](https://github.com/solana-foundation/solana-go/blob/v2/README.md)
for installation details, migrating from v1, and examples.
