in Go

Desktop Application Development with Go

Desktop Application Development with Go

The first curious topic when learning a new programming language, frameworks and what can be done about this technology.

Go programming language didn’t publish a desktop application framework as official. Because it is not its goal… The goal of Go is to develop system and Web server-focused infrastructure applications.

How is it?

I’ve seen many different ways to do desktop programming with Go. We can build desktop application using Electron.js, HTML-JS etc…  But we want to use native solutions. That’s why, we’ll focus on the native Go frameworks. 

What can we use?

My suggestion would be to use the Go framework created to work with Qt/QML. Qt is a very advanced and widely used framework. I’ll use the ‘andlabs/ui‘ framework as an example of this article. Actually, I’ll just do copy/paste from GitHub

Let’s start with example:

First, download the library ‘andlabs/ui‘:

go get

Source code of the application:

package main
import (
func main() {
    err := ui.Main(func() {
        name := ui.NewEntry()
        button := ui.NewButton("Selamla")
        greeting := ui.NewLabel("")
        box := ui.NewVerticalBox()
        box.Append(ui.NewLabel("Ad:"), false)
        box.Append(name, false)
        box.Append(button, false)
        box.Append(greeting, false)
        window := ui.NewWindow("Merhaba", 250, 100, false)
        button.OnClicked(func(*ui.Button) {
            greeting.SetText("Merhaba, " + name.Text() + "!")
        window.OnClosing(func(*ui.Window) bool {
            return true
    if err != nil {

When we run the project we’ll see the UI of the application. In the same way, we can work with ‘go build‘ simply by compiling the project We’ll be producing and .exe in this way. But it is not enough! Because this project will work with a console application in the background.

Therefore, we need to compile this application in the following way.

go build -ldflags -H=windowsgui main.go

Screenshots of the application

The source code of the above application you can access from the following link:

Good work!
Cihan Özhan

Write a Comment