Practical overview
When it fits
Use it when a Go project needs client code for a Solana program built with Anchor and the program's IDL is available in a supported format.
Who it is for
- Go developers building applications or services that interact with Anchor-based Solana programs.
- Teams that have a program IDL and need Go representations of its instructions and data structures.
Documented uses
- Generate Go client code from an Anchor IDL.
- Create Go representations of program instructions, accounts, events, types, tuple types and constants.
- Use generated clients in Go services that interact with Solana programs.
Requirements & limits
The code is available from a public GitHub repository identified as MIT-licensed. Installation and use are documented through the Go CLI.
- The IDL must use Anchor format v0.30.0 or later; older files need conversion.
- The documented generated coverage includes instructions, accounts, events, types, tuple types and constants, but not error parsing.
- The workflow requires the program ID as well as the IDL and output directory.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Generate Go code from an Anchor IDL
Install Anchor Go and generate client code using an IDL file and program ID.
Before you start
- Go installation, for the documented go install command.
- An Anchor IDL in format v0.30.0 or later.
- The IDL file path, desired output directory and program ID.
Steps
Install with the command below.
go install github.com/gagliardetto/anchor-go@latestRun
anchor-go --idl /path/to/idl.json --output ./generated --program-id 0123456789abcdef0123456789abcdef0123456789, substituting the relevant file, directory and program ID.
Expected outcome
Generated Go client code for the Solana program, covering instructions, accounts, events, types, tuple types and constants.
Guide limitations
- The documented tool version supports Anchor IDL format v0.30.0 and later.
- Error parsing is listed as unsupported.
- Older IDLs must be converted to the supported format using Anchor's
anchor idl convertcommand.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 8 October 2026
- Original website title
- gagliardetto/anchor-go · Official homepage title · retained in its source language

