Hello everyone,
I've recently started exploring the world of WebAssembly, and I'm currently experimenting with Wasmtime in Go (wasmtime-go
). I'm encountering some challenges understanding the current status of certain features and compatibility.
Specifically, I'd appreciate it if someone could clarify the following points:
wasmtime-go
bindings? I haven't found explicit documentation confirming support or limitations.wasmtime-go
—is this correct?Apologies if my questions seem unclear or lack detail; the available documentation left me uncertain.
Thanks in advance for your help!
that's largely true but preview 2 is possible in go using tinygo; I don't know what the status of wasmtime-go is, however.
Component (and thus WASIp2) support for wasmtime-go
is blocked on https://github.com/bytecodealliance/wasmtime/pull/9812; likewise for any other Wasmtime embedding that uses the C API (e.g. wasmtime-dotnet
). The one exception is wasmtime-py
, which has its own, very limited support for components built in pure Python (insufficient for WASIp2, but works for simple components).
However, you might be interested in https://github.com/arcjet/gravity, which aims for component support in pure Go, based on Wazero.
As others have mentioned, TinyGo is the way to go for P2 components in Golang right now.
If you'll pardon the vendor-specific link, there's an example you can peek at for golang:
https://github.com/wasmCloud/go/tree/main/examples/component/http-server
HTTP stuff is abstracted away to wasihttp
, but the go:generate
calls in use there should be able to help.
The invoke example is a little bit simpler.
I'm not sure exactly what you mean by "ping server" (is the component doing the pings? is it actually ICMP or HTTP/S? etc), but network is supported currently in preview2, and in fact TLS support just landed in wasmtime main. The edges may be rough, but you should be able to make HTTP connections, raw socket connections, TLS connections and more from WASI p2 components at this point.
I think the question right now is just how many flags you'll need to add to wasmtime run
/wasmtime serve
, and what your WIT world should look like exactly :)
https://github.com/ydnar/wasi-http-go/issues/17#issuecomment-2728984527
that repo will build directly, though you can see the messiness that yet still exists with p2. But it's possible.
Last updated: Apr 08 2025 at 19:03 UTC