This file provides guidance to AI coding agents (Claude Code, Codex, Cursor, Copilot, and others) working in this repository. It is loaded into agent context automatically — keep it concise.
github.com/onflow/flow-go-sdk is the reference Go SDK for the Flow blockchain. It provides
client packages for the Flow Access API over gRPC and HTTP, Cadence-aware transaction and
script helpers, ECDSA/BLS crypto primitives, and account-creation templates. The module is
compatible with the Flow Emulator for local development.
Targets from the root Makefile:
make test— full test suite with coverage (writescoverage.txt). SetsCGO_CFLAGSviacrypto_adx_flag.mk.make coverage— runstest, thengo tool cover -html=coverage.txt.make generate— installsmockery v2.53.5and runsgo generate ./...to regenerate mocks.make check-tidy— runsgenerate, thengo mod tidy, then fails if the working tree is dirty.make check-headers— runs./check-headers.sh; fails if any.gofile is missing the Apache-2.0 header.make ci— full CI pipeline:check-tidy+test+coverage. Matches.github/workflows/ci.yml.make generate-openapi— regeneratesaccess/http/models/from the upstream Flow OpenAPI spec (requiresswagger-codegen).
Examples live in a separate Go module under examples/ with its own Makefile. Run via
make -C examples <target> (e.g. make -C examples send-transactions). Examples require
a running Flow Emulator — see examples/README.md.
- Root package
flow— core domain types:Account,Transaction,Block,Event,Collection,Address. access/—Clientinterface (the primary SDK surface). Two implementations:access/grpc/— gRPC client (grpc.NewClient,grpc.MainnetHost,grpc.TestnetHost,grpc.EmulatorHost). Recommended transport per README.access/http/— REST client.access/http/models/is generated from OpenAPI.
crypto/— key generation, signing, hashing.crypto/awskms/andcrypto/cloudkms/provide AWS KMS and Google Cloud KMS signers.templates/— prebuilt Cadence transactions for account creation and key management.test/— test fixtures (entities.go,greetings.go,signer.go).client/— deprecated; re-exportsaccess/grpc. New code should importaccess/grpcdirectly (seeclient/client.godoc comment).examples/— runnable end-to-end examples against the Flow Emulator. Separate Go module with areplacedirective back to the SDK root (examples/go.mod).
- Go 1.25.0 required (
go.mod). CI pinsgo-version: '1.25'in.github/workflows/ci.yml. - CGO is required by default for BLS support (via
github.com/onflow/crypto). Build withCGO_ENABLED=1. You can build withCGO_ENABLED=0but must also pass theno-cgobuild tag; any BLS call will then panic at runtime (README: Installing). - ADX instructions:
crypto_adx_flag.mkdetects CPU support and setsCRYPTO_FLAGfor BLST. Always invoke via theMakefile(not rawgo test) to pick up the flag on older machines. - Regenerate mocks after interface changes: run
make generatewhenever you touchaccess.Client,access/grpc.RPCClient,access/grpc.ExecutionDataRPCClient, oraccess/http.handler—go:generatedirectives in those files drivemockery.make check-tidyfails CI if generated output is not committed. - Apache-2.0 license header required on every
.gofile — enforced bycheck-headers.shin CI. - Do not edit
client/— deprecated shim retained for backward compatibility. CONTRIBUTING.mdmentionsmake lint— no such target exists in the Makefile. Usegofmtandgo vetdirectly.- When writing portable code, depend on the
access.Clientinterface so callers can swap gRPC/HTTP; reach forgrpc.BaseClient/http.BaseClientonly when transport-specific options are needed (access/README.md).
access/http/models/*.go— generated byswagger-codegenviamake generate-openapi.access/grpc/mocks/*.go,access/mocks/Client.go,access/http/mock_handler.go— generated bymockeryviamake generate.client/client.go— deprecated shim.go.sum— managed bygo mod.