gowasmer
When compiling Go to WebAssembly, the Go compiler assumes the
WebAssembly is going to run in a JavaScript environment. Hence a
wasm_exec.js
file is provided by the Go compiler and must be
used. However, WebAssembly can actually run everywhere. So we need to
use some hacks to make WebAssembly modules generated by the Go
compiler runnable everywhere. And that's where gowasmer
is useful.
gowasmer
is a port of the wasm_exec.js
file, for Go. It assumes
the WebAssembly runtime is
wasmer-go
.
Alternatively, to avoid using gowasmer
, you can compile your Go
program to WebAssembly with TinyGo as follows:
$ tinygo build -o module.wasm -target wasi .
Usage
See _example
directory.
Installation
$ go get github.com/mattn/gowasmer
License
MIT
Author
Yasuhiro Matsumoto (a.k.a. mattn)