Description
TinyGo's current behavior is to handle module -> component conversion for -target wasip2
.
Where is shell exec today?
wit-bindgen-go
https://github.com/bytecodealliance/wasm-tools-go/blob/main/wit/load.go#L54
wit: parsing / world resolver
Uses wasm-tools to convert wit -> resolved world json.
The resulting json is converted into structs for codegen.
TinyGo
https://github.com/tinygo-org/tinygo/blob/release/builder/build.go#L864
wit: parsing / world resolver
wasm metadata: attach wit to wasm (wasm-tools component embed
)
wasm component encoder: convert wasm module to component ( wasm-tools component new
)
Uses wasm-tools
to adapt a wasm module to component.
Discussion
Should TinyGo / Go generate core wasm modules and leave metadata/component encoding to 3rd party tools; or should they be part of a wasi target ( or goos/goarch combination )?
Assuming we implement wit parsing / wasm patching in Go:
- How do we keep up with wit spec?
- In what sequence we'd create these packages?