Building Code Samples

The code samples in this tutorial can be built and run on your computer, all you need is a working Go installation and the prerequisites for Fyne.

Once you have Go installed you can copy any example (use the “Copy Code” button) and paste it into a text file. Save the file with “.go” extension, such as “hello.go”. You can then run the file directly using “go run” on the command line:

go run hello.go

This command will run the application from your computer. For simple go programs this will output some information to your command line. However most examples in this tour will open a new window on your computer!

They can also be built as applications to run later using the “go build” command;

go build hello.go

This will create an executable file that can be run any number of times.

Example Code

package main

import "fmt"

func main() {
	fmt.Println("I am running on your computer")