wit/bindgen: Move wasmimports/wasmexports to a dedicated file#194
wit/bindgen: Move wasmimports/wasmexports to a dedicated file#194ydnar merged 5 commits intobytecodealliance:mainfrom
Conversation
ydnar
left a comment
There was a problem hiding this comment.
This is great, thanks for drafting the PR. I support this direction.
|
FYI, this project follows the Go project conventions for PR names and commit messages: |
Signed-off-by: Lucas Fontes <lucas@cosmonic.com>
24f3ab4 to
82bf7a9
Compare
ydnar
left a comment
There was a problem hiding this comment.
One minor change, we could do now or later.
|
Do you want to update the PR description to reflect current changes? |
|
I checked out the branch and ran I think it’s important that If the wasm functions are sequestered in a .wasm.go file, how do you think we can accomplish this? |
Signed-off-by: Lucas Fontes <lucas@cosmonic.com>
It's the I do agree that failing
Duplicating the wasm file doesn't seem to add any value comparing to removing the build tag. Still have the build tag in the PR and can remove it if that makes sense 👍 |
|
Makes sense to extract the wasm calls into a separate file, without the build tag. That lets us merge this now and solve the related problem later. |
Signed-off-by: Lucas Fontes <lucas@cosmonic.com>
Signed-off-by: Lucas Fontes <lucas@cosmonic.com>
|
I should have rebased on |
Move
wasmimportandwasmexportdeclarations to a dedicated file (named<package>.wasm.go).Rationale: The current
.wit.gofile carries Go and functions intended to be used as wasm bridge ( wasm import / export ). Separating go code from wasm bridge allows readers to identify what is crossing the wasm boundary and gate them if needed. A secondary benefit is paving the way forwit-bindgen-goplugins that utilize the existing ABI and bridge into other implementations. The 2 that come to mind:Sample codegen for wasi:logging
logging.wit.go
logging.wasm.go
Edit: a future PR will implement build tags for the
<package>.wasm.gofile, e.g.//go:build wasm || wasm32 || tinygo.wasm.