Empowering Go with WebAssembly System Interface (WASI) Unleashed
14th March 2024
Rajiv Ranjan Singh
Achille Roussel
Rajiv Ranjan Singh
Achille Roussel
package main import "fmt" func main() { fmt.Println("Hello wasip1!") }
The go program is the entrypoint to the Go toolchain. It standardizes how developers build and maintain their applications.
$ go build
$ go mod
$ go fmt
$ go test
$ go tool pprof
8
4 contributors
2 proposals
go:wasmimport
The new compiler directive that would allow us to develop WASI
GOOS=wasip1
The new target platform to implement the Go runtime on top of WASI
1 partial implementation
package main import "unsafe" //go:wasmimport env fasthash func fasthash(p unsafe.Pointer, n int32) uint64
Simple two step process:
package main import "fmt" func main() { fmt.Println("Hello wasip1!") }
$ GOARCH=wasm GOOS=wasip1 go build -o main.wasm main.go
$ wazero run main.wasm
Hello wasip1!
16
Qualities
Limitations
Extensions
Go
TinyGo
Three main workstreams:
GOARCH=wasm32
go:wasmexport
WASI preview 2
TinyGo contributors are working on an experimental support for wasip2
Rajiv Ranjan Singh
Achille Roussel