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

https://github.com/sd2k/go-component-example

Example of a Wasm component written in Go, using net/http, running in Wasmtime
https://github.com/sd2k/go-component-example

Last synced: 3 months ago
JSON representation

Example of a Wasm component written in Go, using net/http, running in Wasmtime

Awesome Lists containing this project

README

          

# Go WebAssembly Component Example

This example demonstrates how to use [wit-bindgen-go] to generate Go bindings for a WebAssembly component,
[tinygo] to build the component,
[wkg] to manage the component's dependencies,
and [wasmtime](https://github.com/bytecodealliance/wasmtime) to run the component.

## Building

### Dependencies

There are rather a lot of dependencies required for this:

- [Rust][rust]
- [wkg]
- [tinygo]
- [wit-bindgen-go]

There are two stages: building the component, then building (and running) the runtime.

### Building the component

```sh
just build-component
```

### Running inside Wasmtime

```sh
just run-host
```

[rust]: https://rustup.rs
[wkg]: https://github.com/bytecodealliance/wasm-pkg-tools
[tinygo]: https://github.com/tinygo-org/tinygo
[wit-bindgen-go]: https://github.com/bytecodealliance/go-modules