DEV Community

Cover image for A Sample Project Using WebAssembly with Go
XD-DENG
XD-DENG

Posted on

A Sample Project Using WebAssembly with Go

Earlier I wrote a service with Go, doing stuff like hash text, generate random password, base64 encoding/decoding, interpret unix time, etc. When I shared it with my colleague, his first reaction was to ask me if these are executed in browser or at server side. My answer was "server side" and he was not really satisfied, which is totally understandable.

Recently I got time to try WebAssembly, and I realise this service would be a nice example for WebAssembly: I can still write almost everything in Go, but eventually executed in client-side browser (I do understand the stuff can be done with JavaScript easily, but I simply want to try something different).

Here comes the result: https://handytools.xd-deng.com, and the source code on GitHub https://github.com/XD-DENG/handytools-go-webassembly. Overall the experience was quite nice, and I do look forward to see how WebAssembly would evolve and be used more broadly in the near future.

I think this project may work as a nice minimal example for folks who wonder how WebAssembly works with Go, so sharing here.

Let me know how you find it :)

Top comments (0)