| ▲ | Imustaskforhelp 6 hours ago | |||||||
If someone is interested in running golang projects on niche hardware perhaps, one pro tip I can suggest but there is way to convert golang 100% into wasm (no js shim or anything required) and the only thing you would need is a wasm library You have to use golang from source (see the stackoverflow page https://stackoverflow.com/questions/76087007/golang-to-wasm-... ) go install golang.org/dl/gotip@latest gotip download GOOS=wasip1 GOARCH=wasm gotip build -o main.wasm Although the way I did it is going into the gotip folder and then the binary folder which would contain the go compiler binary and then just use that path with GOOS=wasip1 GOARCH=wasm ~/sdk/gotip/bin/go build -o main.wasm Note that I forgot the exact path but it was similar to this but the point being that its super easy and simple :) I tried to do it and I can tell you that it works and it works for even the most latest versions of golang, all you need is a wasmengine which I suppose can be ubiquitous. I have built a solution where golang code gets converted to wasm and then we run a ssh server which then runs that wasm all in sandbox to create sandboxed mini golang servers :p I really love it although its a more so prototype than anything | ||||||||
| ▲ | gothink 3 hours ago | parent [-] | |||||||
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:
If you're interested in wasm/wasi and niche hardware with Go, you should check out TinyGo [1] if you haven't already. | ||||||||
| ||||||||