wit/bindgen: fix wasm-tools WIT generation bugs#287
Merged
Conversation
These were previously swallowed.
This allows the use of use statements inside of inline interface imports.
sd2k
added a commit
to sd2k/tinygo
that referenced
this pull request
Feb 24, 2025
This commit switches from wasm-tools-go to the newer go.bytecodealliance.org repository. Right now it's pinned to the latest commit on the `main` branch because there were some important fixes in bytecodealliance/go-modules#287, but once there's been a new release we can switch to a proper version. The `cm` package moved from a submodule to a separate module, so the Makefile has been updated to reflect that. The `wasi-syscall` and `wasi-cm` Make targets needed updating to work with the latest versions of the tooling. Unfortunately, building with this version doesn't actually work due to an import cycle. For example, trying to build the [example] with: ```bash $ GOTOOLCHAIN=go1.23.6 ../../go/tinygo/build/tinygo build -target=wasip2 -o add.wasm -wit-package wit/add.wit -wit-world adder main.go package command-line-arguments imports runtime imports internal/cm imports encoding/json imports fmt imports os imports io/fs imports time imports syscall imports internal/cm: import cycle not allowed package command-line-arguments imports runtime imports internal/cm imports encoding/json imports encoding/base64 imports encoding/binary imports slices imports iter imports runtime: import cycle not allowed ``` I'm pretty sure this was caused by bytecodealliance/go-modules#279 which added the `encoding/json` import. [example]: https://component-model.bytecodealliance.org/language-support/go.html
sd2k
added a commit
to sd2k/tinygo
that referenced
this pull request
Feb 24, 2025
This commit switches from wasm-tools-go to the newer go.bytecodealliance.org repository. Right now it's pinned to the latest commit on the `main` branch because there were some important fixes in bytecodealliance/go-modules#287, but once there's been a new release we can switch to a proper version. The `cm` package moved from a submodule to a separate module, so the Makefile has been updated to reflect that. The `wasi-syscall` and `wasi-cm` Make targets needed updating to work with the latest versions of the tooling. Unfortunately, building with this version doesn't actually work due to an import cycle. For example, trying to build the [example] with: ```bash $ GOTOOLCHAIN=go1.23.6 ../../go/tinygo/build/tinygo build -target=wasip2 -o add.wasm -wit-package wit/add.wit -wit-world adder main.go package command-line-arguments imports runtime imports internal/cm imports encoding/json imports fmt imports os imports io/fs imports time imports syscall imports internal/cm: import cycle not allowed package command-line-arguments imports runtime imports internal/cm imports encoding/json imports encoding/base64 imports encoding/binary imports slices imports iter imports runtime: import cycle not allowed ``` I'm pretty sure this was caused by bytecodealliance/go-modules#279 which added the `encoding/json` import. [example]: https://component-model.bytecodealliance.org/language-support/go.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Errors from
wasm-toolswere being silently swallowed, masking a number of related issues:import foo:foo/flagswere not being escaped (foo:foo/%flags).wasm-toolsinvocations (in wasm) were being silently ignored. They are now logged and returned. Errors returned fromwasm-tools component embedare now fatal.wit/bindgennow supply a logger toGo().The synthetic world now uses the original WIT package, to allow inline
import foo: interface { ... }with inlineusestatements that refer to other interfaces or worlds in the same package.Fixes #281.