Skip to content

cm: implement JSON [un]marshaling for List types#279

Merged
ydnar merged 12 commits intomainfrom
ydnar/serialize-list
Dec 28, 2024
Merged

cm: implement JSON [un]marshaling for List types#279
ydnar merged 12 commits intomainfrom
ydnar/serialize-list

Conversation

@ydnar
Copy link
Collaborator

@ydnar ydnar commented Dec 28, 2024

Evolution of #266.

Signed-off-by: Lucas Fontes <lucas@cosmonic.com>
Signed-off-by: Lucas Fontes <lucas@cosmonic.com>
Signed-off-by: Lucas Fontes <lucas@cosmonic.com>
@ydnar ydnar self-assigned this Dec 28, 2024
@ydnar ydnar changed the title cm, wit/bindgen: implement JSON [un]marshaling for List types cm: implement JSON [un]marshaling for List types Dec 28, 2024
@ydnar ydnar marked this pull request as ready for review December 28, 2024 22:07
@ydnar ydnar merged commit 9e12543 into main Dec 28, 2024
@ydnar ydnar deleted the ydnar/serialize-list branch December 28, 2024 23:54
sd2k added a commit to sd2k/tinygo that referenced this pull request Feb 24, 2025
This commit switches from wasm-tools-go to the newer
go.bytecodealliance.org repository.

Right now it's pinned to the latest commit on the `main` branch
because there were some important fixes in
bytecodealliance/go-modules#287, but once
there's been a new release we can switch to a proper version.

The `cm` package moved from a submodule to a separate module, so
the Makefile has been updated to reflect that. The `wasi-syscall`
and `wasi-cm` Make targets needed updating to work with the latest
versions of the tooling.

Unfortunately, building with this version doesn't actually work due
to an import cycle. For example, trying to build the [example] with:

```bash
$ GOTOOLCHAIN=go1.23.6 ../../go/tinygo/build/tinygo build -target=wasip2 -o add.wasm -wit-package wit/add.wit -wit-world adder main.go

package command-line-arguments
        imports runtime
        imports internal/cm
        imports encoding/json
        imports fmt
        imports os
        imports io/fs
        imports time
        imports syscall
        imports internal/cm: import cycle not allowed

package command-line-arguments
        imports runtime
        imports internal/cm
        imports encoding/json
        imports encoding/base64
        imports encoding/binary
        imports slices
        imports iter
        imports runtime: import cycle not allowed
```

I'm pretty sure this was caused by
bytecodealliance/go-modules#279 which added the
`encoding/json` import.

[example]: https://component-model.bytecodealliance.org/language-support/go.html
sd2k added a commit to sd2k/tinygo that referenced this pull request Feb 24, 2025
This commit switches from wasm-tools-go to the newer
go.bytecodealliance.org repository.

Right now it's pinned to the latest commit on the `main` branch
because there were some important fixes in
bytecodealliance/go-modules#287, but once
there's been a new release we can switch to a proper version.

The `cm` package moved from a submodule to a separate module, so
the Makefile has been updated to reflect that. The `wasi-syscall`
and `wasi-cm` Make targets needed updating to work with the latest
versions of the tooling.

Unfortunately, building with this version doesn't actually work due
to an import cycle. For example, trying to build the [example] with:

```bash
$ GOTOOLCHAIN=go1.23.6 ../../go/tinygo/build/tinygo build -target=wasip2 -o add.wasm -wit-package wit/add.wit -wit-world adder main.go

package command-line-arguments
        imports runtime
        imports internal/cm
        imports encoding/json
        imports fmt
        imports os
        imports io/fs
        imports time
        imports syscall
        imports internal/cm: import cycle not allowed

package command-line-arguments
        imports runtime
        imports internal/cm
        imports encoding/json
        imports encoding/base64
        imports encoding/binary
        imports slices
        imports iter
        imports runtime: import cycle not allowed
```

I'm pretty sure this was caused by
bytecodealliance/go-modules#279 which added the
`encoding/json` import.

[example]: https://component-model.bytecodealliance.org/language-support/go.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants