Remix.run Logo
gothink 3 hours ago

Looks like this is available (since Go 1.21 [0]), so no need to build from source anymore. Just did a quick 'hello world' test to verify and it worked:

    GOOS=wasip1 GOARCH=wasm go build -o main.wasm main.go
    wasmtime main.wasm
If you're interested in wasm/wasi and niche hardware with Go, you should check out TinyGo [1] if you haven't already.

[0] https://go.dev/blog/wasi

[1] https://tinygo.org/docs/guides/webassembly/wasi/

Imustaskforhelp 2 hours ago | parent [-]

Oh wow thanks for telling me, looks like I was using gotip/ source go for no reason but thanks for telling me this, this actually really simplifies a lot of things :p

Tinygo is really awesome but I have heard that it has its differences so software written for golang won't really work ootb on tinygo and tinygo is really fascinating project too!

I have a question but is it possible to create golang compiler itself within wasm itself. I tried doing it but it didn't really work out but I am curious if someone has thought of doing something like this or has already done it?