WebAssembly examples in Go
- Understanding WebAssembly and interoperability with Go and Javascript - This is a gentle introduction to the world of WebAssembly from the lens of Go and Javascript. The purpose of this primer is to introduce WebAssembly to people who are already familiar with Go and want to use their understanding to build fast programs for the web and other environments outside the world of Go. If you are already substantially familiar with WebAssembly, you may want to directly jump to the experiments.
- go-wasm-examples — Some small examples of using Go and WebAssembly
- Go WebAssembly Tutorial - Building a Calculator Tutorial
- Official TinyGo Browser Example - How to call WebAssembly from JavaScript in a browser. You can call a JavaScript function from Go and call a Go function from WebAssembly.
- WASI Hello World Example in Go from Wasm by Example - In this example, We will be writing "Hello world!" to both the console (
stdout
), and a newly created filehelloworld.txt
. We highly reccomended that you have read the WASI Introduction before procedding with this example.
- Go-app
— Go-app is a package for building progressive web apps (PWA) with the Go programming language (Golang) and WebAssembly (Wasm).
- Wat2Wasm function
- function from Wasmtime to convert Wat/Witx text format of WebAssembly to the binary format.
- Vugu
— Vugu is an experimental library for web UIs written in Go and targeting webassembly. Guide and docs at https://www.vugu.org. Godoc at https://godoc.org/github.com/vugu/vugu.
- WASM-FETCH
— A go-wasm library that wraps the Fetch API. This is useful since TinyGo does not support
net/http
.
Go Runtimes for WASM runtimes
- WasmEdge WebAssembly runtime for Go - The WasmEdge is a high performance WebAssembly runtime optimized for server side applications. This project provides a golang package for accessing to WasmEdge.
- Wasmer WebAssembly runtime for Go - A complete and mature WebAssembly runtime for Go based on Wasmer - The leading WebAssembly Runtime supporting WASI and Emscripten.
- Wasmtime WebAssembly runtime for Go
— This Go library uses CGO to consume the C API of the Wasmtime project which is written in Rust. Precompiled binaries of Wasmtime are checked into this repository on tagged releases so you won't have to install Wasmtime locally, but it means that this project only works on Linux x86_64, macOS x86_64 , and Windows x86_64 currently. Building on other platforms will need to arrange to build Wasmtime and use
CGO_*
env vars to compile correctly. Wasmtime is a standalone JIT-style runtime for WebAssembly, using Cranelift. - Wasmtime host example - Example of calling a GCD function (provided as witx). Func
(func $gcd (param i32 i32) (result i32) ...)
is called asval, err := gcd.Call(store, 6, 27)
. - wazero WebAssembly runtime for Go with zero dependencies
— wazero is a WebAssembly Core Specification 1.0 and 2.0 compliant runtime written in Go. It has zero dependencies, and doesn't rely on CGO. This means you can run applications in other languages and still keep cross compilation.
- fastlike
— fastlike is a Go project that implements the Fastly Compute@Edge ABI using
wasmtime
and exposes ahttp.Handler
for you to use.
- waPC Host for Go
— Golang-based WebAssembly Host Runtime for waPC-compliant modules
- waPC Guest Library for TinyGo
— SDK for creating waPC WebAssembly Guest Modules in TinyGo