Feature: Ignore optional export interfaces
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- go, wasm
- Domain
- build-system, tooling
Research direction
Reproduce the setup using the WIT worlds, componentize-go.toml, and the gen/wit_exports files, including the separate CLI and HTTP variants. Start with the componentize-go build command and the reported world-decoding error, then determine how world selection or optional exports should work. Done means CLI, HTTP, and client-only builds export only the interfaces they need.
Written by the indexing model from the issue text.
Description
Description
Currently running into a little issue with an SDK I'm writing. This SDK wraps, among other things, the wasi:cli and the wasi:http interfaces. The setup is something as follows.
WIT:
package jamesstocktonj1:componentize-sdk;
world http {
export wasi:http/[email protected];
}
world cli {
export wasi:cli/[email protected];
}
world all {
include sdk;
include http;
include cli;
}
Componentize Go Toml:
wit_paths = ["./wit"]
worlds = [
"sdk",
"http",
"cli"
]
Issue 1
When I import this package (for example the net/wasihttp path), it builds a component which exports BOTH wasi:http and wasi:cli and then same is true when trying to write a CLI application.
I've tried splitting the gen/wit_exports file into gen/wit_exports_cli and gen/wit_exports_http but componentize-go complains that:
Error: failed to encode component from module
Caused by:
0: failed to decode world from module
1: module was not valid
2: failed to find export of interface `wasi:cli/[email protected]` function `run`
Issue 2
We also have a scenario where we want to export neither CLI or HTTP but instead just want to use the http.Client interface. This again causes the component to export both interface although neither are needed.
Summary
- How can we make certain wit interfaces optional?
- Would it be possible to have optional exports depending on what Go module path is imported?
- Having a
go.modandcomponentize-go.tomlfor each path would be possible but quite wasteful
- Having a
- Can this be done without having to specify a specific interface? e.g.
componentize-go --world foo build ... - Can we fix this in the Componentize Go build side?
For more context this is the SDK in question:
https://github.com/jamesstocktonj1/componentize-sdk
- Dominant language
- Rust
- Stars
- 19
- Forks
- 8
- Avg merge
- 8h 8m
- Merged PRs (30d)
- 4
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from bytecodealliance/componentize-go
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 58/100
bytecodealliance/componentize-go#66 · 1 comment ·
All issues in bytecodealliance/componentize-go
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day