Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with using go-json and TinyGo due to deprecated reflect.SliceHeader #487

Open
hariso opened this issue Dec 6, 2023 · 0 comments
Open

Comments

@hariso
Copy link

hariso commented Dec 6, 2023

Hello!

Before I come to the issue, thanks for all maintainer and contributors for building this great project! Fantastic work by everyone.

My team started using go-json in a project, which is compiled into WASM using TinyGo. However, that doesn't work well. When compiling the code, we're getting

cannot use len(s) / 8 (value of type int) as uintptr value in struct literal

The offending lines are these.

TinyGo's documentation points that StringHeader and SliceHeader, according to the Go docs, cannot be used safely and portably (they are marked as deprecated).

What do you think about making the above mentioned change in go-json? I know that making it work for TinyGo itself isn't a huge argument, but if we add that the StringHeader and SliceHeader are deprecated and not fully portable it might make the case.:)

Example code

package main

import (
	"fmt"

	"github.com/conduitio/conduit-commons/opencdc"
)

func main() {
	fmt.Println("Hello, WebAssembly!")
	fmt.Printf(
		"%v\n",
		opencdc.Record{
			Position: opencdc.Position("abc"),
			Payload: opencdc.Change{
				Before: opencdc.RawData("before"),
				After:  opencdc.RawData("after"),
			},
		},
	)
}
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

No branches or pull requests

1 participant