Stream: wit-bindgen

Topic: tinygo patches


view this post on Zulip Damian Gryski (Nov 10 2026 at 18:07):

I'm working on the wasip3 target for tinygo. As part of that work and also using wit-bindgen to generate bindings for some internal services, I have some patches for go-pkg and wit-bindgen.

go-pkg, 5 commits.

  1. Add a TinyGo implementation for stackful exports. The wit/async package is split. The existing callback code moves to async_callback.go for non-TinyGo builds. A new async_threads.go is for TinyGo. Run runs the export body, then keeps the task alive until the goroutines it started have finished, so a handler can stream a response body from a goroutine.

  2. Add DrainHook to wit/async. A program can say what to wait for when exports overlap.

  3. Add FutureReader.TryRead. The host can drop a future without a value, and Read panics in that case.

  4. Do not export cabi_realloc under TinyGo. TinyGo's runtime already exports one on wasip2 and wasip3, and a second export fails with a duplicate export name.

  5. Require Go 1.24 in go.mod, because the generated bindings use runtime.AddCleanup.

wit-bindgen, 1 commit.

Add --stackful-exports to the Go generator. It emits async-lift-stackful exports and no callback export. The exported function calls witAsync.Run, which is why go-pkg has to land first. The commit also touches crates/core/src/abi.rs, which the other generators use, and I'd like review there.

view this post on Zulip Damian Gryski (Nov 10 2026 at 18:08):

Should I just file PRs for both of these? Is a single PR per project sufficient or would you like them broken up more?

view this post on Zulip Alex Crichton (Nov 10 2026 at 19:05):

One thing I can note is that there's no plans at this time to enable stackful async-lifts in Wasmtime, so if you'd like Go to rely on it then that's likely a conversation that needs to happen

view this post on Zulip Alex Crichton (Nov 10 2026 at 19:07):

Otherwise though for wit-bindgen yeah feel free to send a PR. While I'm not familiar with the development of go-pkg I suspect a PR is probably fine there too


Last updated: Nov 19 2026 at 20:05 UTC