tinygo
Go compiler for microcontrollers, WebAssembly, and small binaries
TLDR
SYNOPSIS
tinygo *command* [*options*] [*packages*]
DESCRIPTION
tinygo is a Go compiler based on LLVM aimed at small places: microcontrollers, WebAssembly (WASM/WASI), and compact command-line programs. It supports a large subset of Go with a focus on small binary size and good CGo interoperability, rather than matching the full performance profile of the standard gc toolchain for highly concurrent server workloads.Common workflows use tinygo flash to compile and write firmware to a board, tinygo build to produce binaries or .wasm modules, and board-specific -target values (150+ boards). Programs can also be built for Linux, macOS, and Windows with TinyGo's OS targets.
PARAMETERS
flash
Compile and flash a program to a connected microcontroller.build
Compile a package to a binary, library, or WebAssembly module.run
Compile and run on the host or target as supported.test
Run package tests.version
Print TinyGo and LLVM version information.targets
List or inspect available targets (see upstream docs for full list).-target *name*
Compilation target (board name, wasip1, wasm, OS targets, etc.).-o *file*
Output path.-buildmode *mode*
Build mode (e.g. c-shared for WASM libraries).-size *level*
Size reporting / optimization related options (see tinygo help).-opt *level*
Optimization level.
INSTALL
CAVEATS
Not every Go program or standard-library package is supported; see TinyGo language support docs. Toolchain setup (compiler, libraries, board toolchains) varies by platform—follow https://tinygo.org/getting-started/. Binary size and performance trade-offs differ from the standard Go compiler.
