bytecodealliance / bytecodealliance/go-modules
The main package contains no worlds
- Vorherrschende Sprache
- Go
- Sterne
- 148
- Forks
- 20
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
I'm encountering behavior that I don't understand in the latest version of `wit-bindgen-go`.
I've created a [detailed reproduction and summary here](https://github.com/asteurer/repro-go-modules)
Here's a brief summary:
When I run `go tool wit-bindgen-go generate --out internal ./wit` I get the following output:
```text
Generated WIT for custom section:
package wasi:clocks@0.2.0;
interface wall-clock {
/// A time and date in seconds plus nanoseconds.
record datetime {
seconds: u64,
nanoseconds: u32,
}
now: func() -> datetime;
resolution: func() -> datetime;
}
package wasi:filesystem@0.2.0 {
...
}
package wasi:io@0.2.0 {
...
}
error: wasm-tools: error: The main package `wasi:clocks@0.2.0` contains no worlds
```
Something I noticed in the output: Both the `filesystem` package and the `io` package enclose their interfaces with brackets, while the `clocks` package ends with a semicolon and its corresponding interface is placed below it:
```
package wasi:clocks@0.2.0;
package wasi:filesystem@0.2.0 {
}
package wasi:io@0.2.0 {
}
```
I tried manually creating the `wasi:clocks` package in a WIT file and tried inserting the file data in place of the `witText` variable [here](https://github.com/bytecodealliance/go-modules/blob/55a8715c694fb4bbe75c269ffd4a0ca14c80c6f1/wit/bindgen/generator.go#L2416); however, it then complains about not having a package header:
```
error: wasm-tools: error: no `package` header was found in any WIT file for this package
```
If I try to add a generic package header, we get another "package contains no worlds" error:
```
error: wasm-tools: error: The main package `foo:bar@0.0.0` contains no worlds
```
Beitragsleitfaden
Rechercherichtung
Beginne mit der im Issue verlinkten Reproduktion und dem Befehl `go tool wit-bindgen-go generate --out internal ./wit`. Untersuche anschließend `wit/bindgen/generator.go` in der Nähe von Zeile 2416, wo `witText` zusammengesetzt wird. Fertig ist die Aufgabe, wenn das generierte WIT ein gültiges Hauptpaket mit einer World enthält und der Befehl nicht mehr meldet, dass das Paket keine Worlds enthält.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- go, wasm
- Bereich
- compilers, tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 38/100