Building compiled, fast, cross platform, desktop apps in Go with QML. All explained. Oh, there is a hot loader too, so no compilation between UI changes
I just love programming in Go. Its fast, its efficient, it prevents bad habits and defines a formatting schema. What a dream.
Not only that, it offers cross platform compilation and runs on all operating systems without the need for Go to be installed. Its compiled!
The only downside I saw was when I wanted to build a desktop app, with a beautiful Gui. It’s a rarity these days, as everything is web based, but there are occasions when a desktop app is the way to go. There is no built in approach to building Guis. This isn’t such a problem as Go can build C code into its binaries, and there are Gui libraries for C. However its not straight up easy to do.
I wanted to use Go to do this, because of the benefit of being able to run the same program on Windows as on the iPhone and the code being identical.
I’ve put together what I deem an effective framework for building apps with Guis in Go. It’s very early stages but it works and its fun to use.
There is a hotloader, so as you update your QML files, while in development mode you don’t have to recompile the Go code aswell. It will automatically update the Gui for you in real time.
There are instructions on building console UIs while developing the back end code. When using Gui frameworks, they take a while to compile so by building the back end logic with a simple console UI as the interface, you get fast compilation times and design of the UI thought through.
As I said above:
- Cross platform
- Desktop and mobile
Anyway, if you are still reading you’re probably looking for a link. Here it is, all instructions and example included. https://github.com/amlwwalker/got-qt
I’ve put a video on youtube to show the hotloading code: https://youtu.be/38gvNBT6VlM