Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Feature: Ignore optional export interfaces

已关闭
#68 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
48/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
冷清
技术栈
go, wasm

调研方向

使用 WIT worlds、componentize-go.toml 和 gen/wit_exports 文件重现该设置,包括独立的 CLI 和 HTTP 变体。先从 componentize-go build command 和报告的 world 解码错误开始,然后确定 world 选择或可选 exports 应如何工作。当 CLI、HTTP 和 client-only 构建只导出它们所需的接口时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

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.mod and componentize-go.toml for each path would be possible but quite wasteful
  • 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

主要语言
Rust
星标
19
派生
8
平均合并
11 天 20 小时
30 天内合并 PR
1

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

bytecodealliance/componentize-go 的其他 Issue

查看 bytecodealliance/componentize-go 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。