3 ms·
Is anyone using Go’s support for compiling to WebAssembly? I know it was added experimentally a few versions ago - is it still being worked on? Is it production
by pansa2 6y ago
Is anyone using Go’s support for compiling to WebAssembly? I know it was added experimentally a few versions ago - is it still being worked on? Is it production-ready? There’s no mention of it in these release notes.
- petercooper 6y agoTwo examples although both in the 'fun' category: - https://healeycodes.com/boids-flocking-simulation/ https://healeycodes.com/boids-flocking-simulation/ - https://dstoiko.github.io/posts/go-pong-wasm/ https://dstoiko.github.io/posts/go-pong-wasm/
- dastx 6y agoWould love to know too. I've recently thought of something that would be great for go wasm.
- kodablah 6y agoWhile I believe it is probably production ready, due to how Go is implemented with implicit coroutines/yielding, generated WASM from Go is larger and has many more instructions than a lower-level languages that map more directly to machine code. For most, this tradeoff is likely negligible.
- deleted 6y ago[deleted]
- dmitshur 6y agoIt’s still supported and developed, but it’s not an area where most activity is currently focused. It is very stable, even more so when it was first added, since bugs are being fixed and regression tests are added. You can see what issues are open and closed at https://github.com/golang/go/issues?q=is%3Aissue+label%3AArch-Wasm https://github.com/golang/go/issues?q=is%3Aissue+label%3AArc.... The Wasm specification is also progressing over time, sometimes unblocking some opportunities in the Go implementation. I’ve been using Go in the frontend in many (most?) of my personal projects since the early days of GopherJS, and by now I’ve compiling most of that frontend code to Wasm. I’m very happy with the experience and results, and my top wishlist item would be improvements to the binary size for faster first-time loads. If you haven’t already seen it, https://golang.org/wiki/WebAssembly https://golang.org/wiki/WebAssembly has lots of good info.
- fizx 6y agoGo makes pretty bad WebAssembly. It only embeds in Javascript, and it's at least 2MB for Hello World. You can't really use it in server-side engines like wasmer/wasmtime. TinyGo is far better, but only supports a subset of Go's stdlib. I'm playing with TinyGo, and using GPRC communication with the outer engine as a poor substitute for WASM interface types. https://github.com/fizx/goingo https://github.com/fizx/goingo if you want to read the ugly prototype!
- syrusakbary 6y agoI'm hoping that Go will focus on improving the size of the binaries soon, specially for the Wasm use cases. goingo is a great idea... excited for it!