wit/bindgen: generate pruned WIT file for each WIT world in the relevant Go package directory#206
Merged
wit/bindgen: generate pruned WIT file for each WIT world in the relevant Go package directory#206
Conversation
Mossaka
approved these changes
Oct 10, 2024
| ### Added | ||
|
|
||
| - Go [type aliases](https://go.dev/ref/spec#Alias_declarations) are now generated for each WIT type alias (`type foo = bar`). Deep chains of type aliases (`type b = a; type c = b;`) are fully supported. Generated documentation now reflects whether a type is an alias. Fixes [#204](https://github.com/bytecodealliance/wasm-tools-go/issues/204). | ||
| - `wit-bindgen-go generate` now generates a WIT file for each WIT world in its corresponding Go package directory. For example the `wasi:http/proxy` world would generate `wasi/http/proxy/proxy.wit`. |
Member
There was a problem hiding this comment.
thoughts on renaming the wit file to proxy@0.2.2.wit?
Member
There was a problem hiding this comment.
⚖️
I think keeping <world>.wit is ok cause we'd never have proxy@0.2.2.wit & proxy@0.2.0.wit in the same directory, but am not strong about it.
What's the motivation @Mossaka ?
Collaborator
Author
There was a problem hiding this comment.
The Go package directory can be versioned, e.g. wasi/http/v0.2.2/proxy/proxy.wit
lxfontes
approved these changes
Oct 10, 2024
9e96a60 to
67db83a
Compare
Collaborator
Author
|
Merging, we can continue to iterate. |
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.
This is a step towards embedding textual WIT in a WebAssembly module generated by TinyGo (and eventually Go), for consumption by downstream programs like
wasm-toolsor for use as runtime metadata.This can be verified by running
go test ./wit/bindgen -writeand examining the contents of thegenerateddirectory.Inspired by #179.