Skip to content

The main package contains no worlds #377

@asteurer

Description

@asteurer

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

Here's a brief summary:

When I run go tool wit-bindgen-go generate --out internal ./wit I get the following output:

Generated WIT for custom section:
package wasi:[email protected];

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:[email protected] {
...
}

package wasi:[email protected] {
...
}

error: wasm-tools: error: The main package `wasi:[email protected]` 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:[email protected];
<INTERFACES>

package wasi:[email protected] {
    <INTERFACES>
}

package wasi:[email protected] {
    <INTERFACES>
}

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; 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:[email protected]` contains no worlds

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions