-
Notifications
You must be signed in to change notification settings - Fork 20
Conversation
ydnar
commented
Mar 13, 2025
Can we have this share WIT files with the files in testdata?
ydnar
commented
Mar 13, 2025
Should this have its own go.mod file if it has its own CHANGELOG?
Mossaka
commented
Mar 13, 2025
@ydnar I thought testdata is for testing purposes With that said, why do you want to share the WIT files in x/wasihttp with testdata?
LiamRandall
commented
Mar 14, 2025
Nice work on this one @Mossaka!
ydnar
commented
Mar 14, 2025
This PR highlights a bug (or a feature, depending on how you look at it) of wit-bindgen-go that I think we should address before merging: unnecessary, duplicative code generation.
TinyGo’s stdlib already includes the generated bindings for wasi:cli/command. The only reason they’re generated again is because the proxy WIT includes wasi:cli/command. Package wasihttp does not need the full CLI world, except for testing, and does not import the generated code.
I’d like to propose a feature for wit-bindgen-go to limit the generated code to a specific WIT package (or world or interface), so the generated bindings in x/wasihttp/internal are more narrowly scoped to what’s necessary to implement wasi-http.
elewis787
commented
Mar 14, 2025
This PR highlights a bug (or a feature, depending on how you look at it) of
wit-bindgen-gothat I think we should address before merging: unnecessary, duplicative code generation.TinyGo’s stdlib already includes the generated bindings for
wasi:cli/command. The only reason they’re generated again is because the proxy WIT includeswasi:cli/command. Packagewasihttpdoes not need the full CLI world, except for testing, and does not import the generated code.I’d like to propose a feature for
wit-bindgen-goto limit the generated code to a specific WIT package (or world or interface), so the generated bindings inx/wasihttp/internalare more narrowly scoped to what’s necessary to implementwasi-http.
@ydnar I am interested in following along on this.
I would add that when developing libraries that intend to wrap imports and exports off shared interfaces, there are also conflicts in generating code. This is not directly related, but it is something I've been attempting to resolve. Happy to write a separate issue for this explaining what I think is the conflict.
This commit ports the wasihttp package from the [wasi-http-go](https://github.com/ydnar/wasi-http-go) repository to here under the `x/wasihttp` directory. The wasihttp package provides a WASI HTTP server and client implementation using Go net/http package. The ./x/wasihttp/internal directory is regenerated using `make go-bindings` command from the wasihttp Makefile. Examples can be found in the `x/wasihttp/examples` directory and can be run under the ./x/wasihttp working directory. This new package has its own CHANGELOG.md, README.md, and RELEASE.md files to document the changes, usage, and release notes. Signed-off-by: Jiaxiao Zhou <duibao55328@gmail.com>
Signed-off-by: Jiaxiao Zhou <duibao55328@gmail.com>
- also update go.work to include the new package - slice the proxy.wit to only include the necessary imports - re-generate the bindings Signed-off-by: Jiaxiao Zhou <duibao55328@gmail.com>
and update the examples docs to refer to the right working directory and command to build. Signed-off-by: Jiaxiao Zhou <duibao55328@gmail.com>
5c3b85f to
5f3f040
Compare
Mossaka
commented
Mar 20, 2025
I’d like to propose a feature for
wit-bindgen-goto limit the generated code to a specific WIT package (or world or interface), so the generated bindings inx/wasihttp/internalare more narrowly scoped to what’s necessary to implementwasi-http.
Sounds good to me. I've limited the generated code to this specific WIT world:
world proxy { import wasi:clocks/monotonic-clock@0.2.0; import wasi:io/streams@0.2.0; import wasi:io/error@0.2.0; import wasi:io/poll@0.2.0; import wasi:http/types@0.2.0; import wasi:http/outgoing-handler@0.2.0; export wasi:http/incoming-handler@0.2.0; }
it's much more narrowly scoped than before and wasi:clocks and wasi:io are the only necessary packages that wasi:http/types interface depends on.
Signed-off-by: Jiaxiao Zhou <duibao55328@gmail.com>
Signed-off-by: Jiaxiao Zhou <duibao55328@gmail.com>
Signed-off-by: Jiaxiao Zhou <duibao55328@gmail.com>
Mossaka
commented
Apr 12, 2025
@ydnar please take a look and let me know your thoughts on how to proceed with this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should include 0.37
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
Uh oh!
There was an error while loading. Please reload this page.
This commit ports the wasihttp package from the wasi-http-go repository to here under the
x/wasihttpdirectory. The wasihttp package provides a WASI HTTP server and client implementation using Go net/http package.The
./x/wasihttp/internaldirectory is regenerated usingmake go-bindingscommand from the wasihttp Makefile. Examples can be found in thex/wasihttp/examplesdirectory and can be run under the ./x/wasihttp working directory.This new package has its own CHANGELOG.md, README.md, and RELEASE.md files to document the changes, usage, and release notes.
Signed-off-by: Jiaxiao Zhou duibao55328@gmail.com