TinyGo
TinyGo is an alternative Go compiler for microcontrollers, WebAssembly (WASM/WASI), and command-line tools. It pairs Go libraries with LLVM to produce small binaries for embedded boards and WASM runtimes.
Visit tinygo-org/tinygoOverview
TinyGo is an alternative Go compiler intended for small places such as microcontrollers, WebAssembly (WASM/WASI), and command-line tools. It reuses libraries from the Go language tools alongside LLVM to compile Go programs for targets the standard toolchain does not handle well.
Key Features
- Supports compiling for over 150 microcontroller boards, with firmware output extensions depending on the target.
- Runs a blink example with the machine package across supported boards with a built-in LED by selecting a different TinyGo target.
- Compiles Go programs to WebAssembly for browsers and to WASI for servers and edge devices, including the WASI Preview 1 example target.
- Supports command-line tools and Linux, macOS, and Windows targets in addition to embedded and WebAssembly targets.
- Uses Go language tool libraries with LLVM for an alternative compilation path and small binary sizes.
Use Cases
- Running Go programs on microcontrollers such as Arduino Uno, Adafruit Circuit Playground Express, and Seeed Studio XIAO-ESP32S3.
- Building WebAssembly modules for browsers and WASI runtimes such as Fastly Compute, Fermyon Spin, and wazero.
- Compiling Go command-line tools and programs for Linux, macOS, and Windows.
Getting Started
- Install TinyGo using the official getting started instructions, clone the repository, and review the examples. For a supported board, compile and flash the blink example with a target such as arduino-uno. For WebAssembly, build an exported function with the wasip1 target.
Deployment & Requirements
- TinyGo runs on Linux, macOS, and Windows, with Docker and Nix builds available. WASI programs can target WASI Preview 1 runtimes such as Fastly Compute, Fermyon Spin, and wazero.
Before You Adopt
- License: Other. Review its terms before using, modifying, or distributing the project.
- WASI tests run through tinygo test are not sandboxed and have read/write access to the host filesystem, so only trusted tests should be run.