An open API service indexing awesome lists of open source software.

https://github.com/mattn/gowasmer

WebAssembly runtime for wasmer-go
https://github.com/mattn/gowasmer

Last synced: 9 months ago
JSON representation

WebAssembly runtime for wasmer-go

Awesome Lists containing this project

README

          

# gowasmer

![gowasmer](https://raw.githubusercontent.com/mattn/gowasmer/main/_example/screenshot.png)

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`](https://github.com/wasmerio/wasmer-go/).

Alternatively, to avoid using `gowasmer`, you can compile your Go
program to WebAssembly with [TinyGo](https://tinygo.org/) as follows:

```sh
$ 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)