A Go GUI, in a few steps.

Build a small counter application with GOUI v0.4.0. The same interface code targets Windows, macOS and Linux; no C/C++ compiler is needed.

01

Create a module

Pin the release so this tutorial does not silently move to a newer API.

Terminal
mkdir hello-goui
cd hello-goui
go mod init example.com/hello-goui
go get github.com/golang-gui/goui@v0.4.0
02

Develop with an AI assistant

Install the official goui-app skill so your coding assistant knows GOUI application development. Send the following instruction to your tool; whether it loads skills is decided by the tool itself. Install instructions

Prompt
Install the GOUI application development skill following https://github.com/golang-gui/goui/blob/main/skills/INSTALL.md.
03

Write your interface

Save the following as main.go. The Modern stylesheet follows system settings; clicking the button updates the state and rebuilds the view.

main.go
package main

import (
    "fmt"
    "log"

    "github.com/golang-gui/goui/theme/modern"
    "github.com/golang-gui/goui/ui"
)

func main() {
    count := ui.MakeState(0)
    err := ui.Run("com.example.Hello", func(app ui.App) ui.RootView {
        return ui.Root().
            StyleSheet(modern.FromSettings(app.Settings())).
            Windows(
                ui.Window("main").
                    Title("Hello GOUI").
                    Size(480, 240).
                    Content(
                        ui.VBox(
                            ui.Label(fmt.Sprintf("Clicked %d times", count.Get())),
                            ui.Button("Click me").OnClick(func() {
                                count.Update(func(old int) int { return old + 1 })
                            }),
                        ).Spacing(12).Padding(20),
                    ),
            )
    })
    if err != nil {
        log.Fatal(err)
    }
}
04

Build and run

On Linux or macOS, use the following commands. Run the application on your desktop, not in a session without a display.

Linux / macOS
CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o hello-goui .
./hello-goui

Windows PowerShell

Use -H=windowsgui to build without a console window. Omit that flag while debugging if you want to see terminal output.

PowerShell
$env:CGO_ENABLED='0'
go build -trimpath -ldflags="-s -w -H=windowsgui" -o hello-goui.exe .
.\hello-goui.exe
05

Choose the next layer

ui is the declarative adapter; gui provides imperative widgets; widgets contains additional controls. Application behavior belongs to your app, not the view declarations.

Building is not always packaging.

An ordinary go build is enough to create the executable. The optional cmd/goui tool prepares Windows icon/version resources, macOS .app metadata and icons, and Linux desktop/icon resources from goui.toml. It does not remove system runtime requirements.

Read the build and package guide

Runtime requirements

Windows

Windows x64 · Win32 windows · DirectWrite text · Direct2D, OpenGL or Software drawing.

macOS

macOS Apple Silicon · AppKit windows · Core Text · OpenGL or Software drawing. Signing and notarization remain application distribution steps.

Linux

Linux x64 · X11 · Pango/Cairo text · OpenGL or Software drawing. Needs native X11, GL, GLib, Fontconfig, Pango/Cairo and GTK runtime libraries. Wayland sessions require XWayland; behavior must be checked on the target desktop.