Building Modern Desktop Apps in Go

  • 2019-03-22 12:14 AM
  • 121

Building Modern Desktop Apps in Go

I’ll show how to quickly build a simple desktop app with Go+HTML5, that doesn’t look like it’s from the 90s, neither it feels bloated like Electron. User interfaces have come a long way from punch cards and command line to post-WIMP era with touch screens and voice input. Modern UI is expected to be fast, responsive and smooth, with high-quality typefaces, rich images, animations, accessibility.

HTML5 handles it all very well, and with GPU acceleration it has decent visual performance. Go may have stated itself as a language for writing services, but with Redux architecture GUI apps are not much different from request/response model. Having excellent performance, Go is a perfect fit for writing core app logic. The only thing that’s missing is a link between HTML5 and Go, so that Go code could be called from the UI, and UI could be manipulated from Go. HTML5 is often considered heavy because it requires a browser engine. We don’t want to ship browser runtime with each and every app. One solution is to reuse the native OS runtime. Another is to use some pre-installed browser in the standalone app mode. Both end up with small, fast, self-contained binaries that are easy to build and to distribute. I would like to briefly explain how each approach works, and how to choose one that fits better for your needs.

I’ll introduce Webview1 and Lorca2 libraries and show how to build a quick desktop app in Go with either of those. I’ll cover bootstrapping the new app, communication between Go and UI layer, debugging UI, building and packaging the app. I’ll do the demonstration on Linux, but will show how to prepare the same app for Windows/MacOS.

Learn More

Learn How To Code: Google’s Go (golang) Programming Language
Go: The Complete Developer’s Guide (Golang)
Build Realtime Apps | React Js, Golang & RethinkDB
Build a chat app with Go
Moving from NodeJS to Go
Building a chat widget with Go and JavaScript
Golang Tutorial: Learn Golang by Examples