示例

完整的、可运行的示例,演示 litesvm-go 的用法。每个示例都是一个独立的 Go 测试,可直接放入包中并使用 go test 运行。

运行示例

# 1) Initialize a Go module (skip if you already have a go.mod)
go mod init mytest
# 2) Add the dependencies to your Go project
go get github.com/LiteSVM/litesvm-go
go get github.com/gagliardetto/solana-go
# 3) Drop an example into a _test.go file and run
go test ./...

在 Alpine / musl 环境下,请在 go test 命令中添加 -tags musl,以链接正确的预编译归档文件。

如需独立的命令行示例(无需测试运行器),请参阅 litesvm-go 仓库中的 examples/transfer/main.go

Is this page helpful?

Table of Contents

Edit Page
©️ 2026 Solana 基金会版权所有