
Learn to build cross-platform GUI desktop apps in Go with Fyne, delivering small, dependency-light binaries for Mac, Windows, and Linux, via projects like a markdown editor and a gold watcher.
Meet an instructor with 25 years in the software industry as an independent contractor and decades of university teaching, holding a PhD in English literature, computer science, and education.
Install Go by visiting go.dev, choosing the correct download for your operating system, and following the installation instructions. Verify the setup by running go version to confirm the installed version.
Install Visual Studio Code as a cross-platform Go IDE, then add the official Go extension and Go template syntax for easier coding and template work.
Install make, a versatile build tool, to use with the course's make scripts. On Mac, use Homebrew and brew install make; on Windows, use Chocolatey with choko install make.
Search online first when you need help, as others may have faced similar issues. Download the lecture code to compare, then share enough code or a git link.
Observe how mistakes propel software development by watching the instructor make and fix errors in real time in this intermediate Go and Fyne GUI course.
Install the necessary tools for Fyne and Go, including a C compiler and OS bindings to compile the application with the system graphics drivers across macOS and Windows.
Write a simple hello world Fyne app in Go by initializing a module, installing Fyne, creating a window with a label, and running the app to see a functional window.
Discover the structure of a Fyne Go application, with a single app variable, at least one window, a wrapper container for widgets, and the show-and-run event loop.
Create a simple Fyne app with a window, label, text entry, and button in a vertical container. Type text, press the button, and update the label.
Build a simple markdown editor with a left editing pane and a live right-pane preview, using Fyne and Go, with cross-platform menus and save and open file operations.
Explore building a markdown editor in Go using the Fyne GUI toolkit, with a two-pane interface (edit and preview), live markdown rendering, and groundwork for file menus.
Learn to add a main menu in a Fyne app by creating open, save, and save as items, building a file menu, and attaching it to the window.
Implement a save as function for the menu, showing a Fyne save dialog, handling errors and cancel, then write the edit content and update current file and window title.
Open files using an open dialogue, read contents, populate the editor, update the current file and window title, and enable saving, with a future filter to open only markdown files.
Add a filter to the open file dialog to permit only markdown files, and enforce a .md extension with a default untitled.md save name and an information dialog if needed.
Make the save menu item functional by implementing a save function that writes the current file using the storage writer, handles errors with a dialog, and prevents resource leaks.
Package your fyne-based go app into a native binary. Install fyne, add an icon, set version and name, and build a distributable Mac or Windows app.
Write a simple test for a fyne Go application, focusing on unit testing UI components like edit and preview, and demonstrate basic app testing with a Makefile.
Learn to define a custom Fyne theme in Go by declaring a theme type, overriding color and font methods, and applying it in main to customize UI colors.
Develop a real-time gold price tracker app in Go using Fyne, with a price bar, currency switch, chart, holdings table, and embedded database; update prices every 30 seconds.
Initialize the go mod, configure a fyne app with info and error loggers, and outline a SQL Lite database and repository pattern, then create and show the gold watcher window.
Builds the fyne app's main window, resizes it, and sets it as the master window, with a scaffolded make ui function for a gold price display.
Fetch the current gold price from goldprice.org by building a Go function that returns three price information objects, parsing the JSON items array into currency, price, change, and previous close.
Write unit tests for the gold prices logic by creating a test setup, mocking an http client, and validating the get prices function using a custom transport and json responses.
Create a get price text function returning open, current, and change texts from gold.get prices, with gray when network fails, then assemble them in a 3-column price content grid.
Set up a three-column grid to display open price, current price, and price change, embed in a resizable window, and refresh the price container every 30 seconds.
Write a test for get price text by introducing a test file, injecting a fake HTTP client, and wiring a test app to verify the formatted opening price in USD.
Create a Fyne toolbar with a spacer and actions (document create, refresh, settings) using icons, add it to the main window, and prepare for future functionality.
Write a simple test for the get toolbar function to ensure four items, and refactor to pass the main window from the app, wiring the toolbar into the app config.
Demonstrate adding application tabs in a Fyne app, creating prices and holdings tabs with icons, placing content placeholders, and setting tab location to top, with Gold Price API chart integration.
Build a fyne gui prices tab that fetches a live gold price chart from a url, downloads the image via http client, and renders it in the app.
Develop the get chart function to build a currency-specific URL, download the chart image with Fyne canvas, handle download errors, and size and display the image with a fill mode.
Handle network failure by bundling a local network-unreachable image into the app using fyne bundling, convert it to go code, and load it from the bundled resource when downloads fail.
Create a chart container and attach the chart image to the price tab, replace the canvas with price content, and run the app to display the chart.
Implement a refresh price content function that updates the top price container and the price chart by fetching current prices from goldprice.org and refreshing the canvas objects.
Enable the refresh icon in the toolbar to update gold price data and the chart via a refresh call. A background go routine updates prices every 30 seconds.
Launch a background go routine to refresh gold prices every 30 seconds, updating the UI with current opening and change prices and refreshing the chart.
Embed sqlite into desktop app binary, implement a sqlite repository pattern, and test the database, while managing file storage across operating systems for a Fyne and Go graphical user interface.
Set up a sqlite embedded database in go using the repository pattern. Define the holdings struct with id, amount, purchase date, purchase price, and implement migrate, insert, get, update, delete.
Implement a sqlite repository in go by defining a repository struct with a db connection, and implement migrate, insert holding, and all holdings to manage holdings with unix timestamps.
Implement and test a sqlite repository in Go, completing get holding by id, update holding, and delete holding functions for the holdings table.
Create a test data folder, implement TestMain to open a sqlite database for testing, initialize a test repository, install a sqlite driver, and import it for side effects.
Learn to test a SQLite database repository in Go, covering migrate, insert holding, all holdings, get holding by ID, update holding, and delete holding, with a test data folder.
Connect your Fyne and Go application to SQLite by refactoring main, creating a connect SQL function, and wiring a database repository with migrations, path resolution, and test repository setup.
Learn to create a lightweight test repository for your Go application by copying the real DB repository interface, implementing a minimal test type, and wiring it into the test setup.
Convert the holdings tab from a canvas placeholder to a table widget showing labeled rows with delete buttons, populated via an SQLite query and a refresh function.
Populate the holdings tab by loading current purchases and the gold they've bought from the database into a table widget, allow entry via a dialog, and save new holdings.
Implement and test the get holding slice to convert database holdings into a table-ready slice of interfaces with headings and a delete button.
Review and run tests for the getHoldingSlice function, validating a three-row result (two data rows plus a heading) via go test, and prepare to implement the get holdings table.
Build and customize a Fyne table widget for a Go GUI app by wiring data, column widths, and a delete button with a confirmation dialog and a table refresh.
Define config fields for holdings data and the holdings table, populate app holdings and the widget table from get holding slice, and prepare a refresh function for the table.
Implement the refresh holdings table function to fetch new holdings data from the database, update the app config, and refresh the holdings table UI in the canvas.
Build and display the holdings table in the holdings tab by constructing a container, wiring the holdings table into the UI, and validating that the table renders with headings.
Enter data into an SQLite database using beekeeper studio, configure the DB path with a Makefile, and insert a holdings record with a unix purchase date and price.
Change the holdings tab container from a vbox to a border layout, wrapping the holdings table in a container dot new adaptive grid to fill available space.
Debug and fix a delete button issue by updating data binding to app.holdings and refining the GetHoldings table logic, then verify Yes confirms deletion and No retains the row.
Enable the add holdings button in the toolbar by opening a dialog form that collects amount, purchase date (iso format), and purchase price when the pencil icon is clicked.
Integrate date, int, and float validators in the add holdings dialog, parse dates with 20060102, enable the add button after validation, then insert the holding and refresh the holdings table.
Fix the price display in the holdings tab by multiplying the stored purchase price by 100 and adjusting the UI, then add a simple Go test for the holdings dialog.
Learn to build a macOS binary with a custom icon, configure the makefile, create an executable, and handle unsigned gatekeeper prompts while saving preferences without a database.
Learn to manage the currency preference for gold price display using Fine app preferences with a string fallback, defaulting to USD; CAD is shown as an example.
Enable the toolbar preferences icon to open a currency selection window with a dropdown (USD, CAD, GBP), save the choice, and refresh prices and the chart.
Learn how to distribute a macOS app by obtaining a developer account, paying about $100 a year, downloading Xcode, and signing the app with a script to avoid gatekeeper warnings.
Create or sign in to an Apple developer account on developer.apple.com, pay the annual fee (about $99 US, $120 CAD), and install Xcode to enable app signing.
Sign your macOS app for distribution by running the Build Zip script, obtaining Apple developer certificates and an app-specific password, and producing a signed dmg for macOS users.
Many developers are intimidated by the idea of writing a desktop application, and this is probably because of the rise of web based applications. In fact, some university computer science programs do not even devote an entire course to developing GUI applications, and that's unfortunate.
Go, sometimes referred as Golang, has quickly risen in popularity over the past decade, and has become extremely popular for building REST APIs, back end applications, and network software. One question that comes up a great deal online, though, is how one might go about building a desktop application using Go. For quite some time, the default answer was use Qt and CGO bindings, but several years ago a new project emerged -- one that makes it relatively easy to build GUI applications in pure Go: the Fyne project. Fyne is a project is based around the premise that it should be free and simple to develop an application that can run on all platforms without modification or adaptation. Fyne apps are installed like regular applications on all platforms and deliver great performance and solid user experience.
With Fyne, you can write your code once, in pure Go, and deliver applications that run on Mac OSX, Windows, Linux, Android devices, iOS devices, and as WebAssembly in the browser.
This course is intended to cover the basics of building a GUI application in pure Go. We will cover:
Building Desktop applications: we'll build two: a MarkDown editor and an application that allows users to track (fictional) Gold investments and get real-time information on Gold prices.
We will cover:
How to work with the Fyne Canvas
How to work with Fyne Windows
How to use (and customize) Widgets, including dialogs, text, labels, input fields, forms, and tables
How to validate user input
How to fetch external resources from remote servers and use them in our application
How to use containers to arrange things in a window
How to embed a sqlite database into a desktop application
How to build custom menu items and link them to actions
How to read and write files from your application
How to read and write preferences
How to bundle assets (e.g. images) into a Fyne application
How to build a single binary with a custom icon
How to sign a Mac OS X application for distribution