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
- Host: GitHub
- URL: https://github.com/sd2k/go-component-example
- Owner: sd2k
- Created: 2025-02-25T09:55:50.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-28T12:23:11.000Z (over 1 year ago)
- Last Synced: 2025-03-06T00:17:25.560Z (over 1 year ago)
- Language: Assembly
- Size: 79.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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