The campus media lab is opening its equipment desk. Students will soon be able to borrow cameras, microphones and tripods. Before we build those features, we need a Go program we can run and understand.
This lesson has one small goal: start from an empty lesson directory and print one message in the terminal. There is no web server, database or hexagonal architecture yet. We will add complexity only when the project needs it.
By the end, you will be able to create a Go module, explain the two files in this project, run its entry point and change the output yourself.
1. Check your tools
You need Go installed, a terminal and a text editor. On macOS or Linux, open your terminal and run:
go versionYou should see a line beginning with go version, followed by the version and your operating system. The exact version may differ. If your terminal says go: command not found, install Go and ensure it is available in your PATH before continuing.
You can find the official installer at go.dev/dl.
2. Create the lesson folder
Open a terminal at the root of the geardesk-golang repository. Then run:
mkdir -p geardesk/00-geardesk-from-zero
cd geardesk/00-geardesk-from-zero
go mod init example.com/geardeskThe first command creates the directory. The -p option also creates missing parent directories. The second command moves your terminal into the new folder. The third command initializes a Go module.

A Go module is a collection of related Go packages with its own module path and dependency information. Go records that information in go.mod.

3. Understand go.mod
The last command creates a file called go.mod. Open it. Its content will look similar to this:
module example.com/geardesk
go 1.27.4Your go version line may differ; Go sets it according to the installed toolchain when the module is initialized. Do not change your version just to match this example.
The line module example.com/geardesk gives the module its identity. In larger projects, Go uses module paths as the beginning of import paths for packages within a module. Here, example.com/geardesk is a tutorial identifier. You do not need to own that domain or publish a website to run this local example.
This lesson has its own go.mod, separate from any go.mod at the repository root. That keeps the lesson self-contained.
4. Write your first Go program
Create main.go next to go.mod. Paste the following code:
package main
import "fmt"
func main() {
fmt.Println("GearDesk equipment desk is open.")
}The code is short, but every part has a job.
package main - make the package executable
Go source files begin with a package declaration. Files in the same directory normally belong to the same package. The special package name main tells Go that this package can be built as an executable program, provided it has a valid main function.
import "fmt" - use a standard library package
fmt is part of Go's standard library. It provides functions for formatted input and output. We import it because we want to print a message. We do not need to install an external dependency.
func main() - define where execution begins
func declares a function. The function named main is the entry point of an executable Go program. After Go starts the program, it calls this function.
fmt.Println(...) - write a line to the terminal
fmt.Println writes the text to standard output, often called stdout. The quoted text is a string. Println adds a newline after the message, so the next terminal prompt appears on a new line.

5. Check the project structure
Your lesson directory should now contain just two files:
geardesk-golang/
└── geardesk/
└── 00-geardesk-from-zero/
├── go.mod
└── main.gogo.mod describes the module. main.go contains the program. That is all we need for this example. There is no go.sum yet because this lesson does not use external modules.
6. Run GearDesk
Make sure your terminal is still inside geardesk/00-geardesk-from-zero/, then run:
go run .Expected output:
GearDesk equipment desk is open.The program prints the message and then exits. It does not stay running in the background.
The dot (.) means the current directory. When you run go run ., Go reads the package in that directory, compiles what it needs, starts the executable and calls main(). It does not leave a normal built executable in your lesson folder.

You can also run go run main.go for this one-file example. We use go run . in the series because it operates on the package in the current directory, which is useful when a package grows to several source files.
7. Change the message - predict, then run
Now make one change without copying the answer from the tutorial. Replace the string inside fmt.Println with:
fmt.Println("GearDesk is ready for students.")Before you run the program, predict the exact output. Will Go print both messages, the original message or only the new message?
Run it again:
go run .You should see:
GearDesk is ready for students.Only the new message appears. Each go run . starts the program from its current source code; the previous run does not keep state for the next one.
For the next lesson, restore the original line:
fmt.Println("GearDesk equipment desk is open.")This is a simple development habit: make a small change, predict what will happen, run the program and compare the result. It helps you learn Go rather than only copy commands.
8. Format and check your code
Go comes with a formatter. Run:
gofmt -w main.go
go run .gofmt -w rewrites the file using Go's standard formatting rules. You do not need to format spaces by hand.
Later, we will add automated tests. You can already type go test ./..., but at this stage Go will report that there are no test files. That is expected and is not the same as having tested the program's behavior.
9. If something does not work
| Problem | Likely reason | What to check |
|---|---|---|
go: command not found |
Go is not installed or is missing from PATH |
Run go version; check the installation |
go.mod file not found |
You ran the command outside the module | Change to geardesk/00-geardesk-from-zero/ |
no Go files |
main.go was not saved in the current folder |
Check the filename and location |
undefined: fmt |
You removed or misspelled the fmt import |
Check import "fmt" |
"fmt" imported and not used |
You imported fmt but removed its use |
Use fmt.Println or remove the unused import |
10. Check your understanding
Without looking at the code, try answering these questions:
- What is the difference between a Go module and the
mainpackage? - Why does
go run .work from inside the lesson directory? - What would happen if you removed
import "fmt"but keptfmt.Println?
If you can answer these and repeat the program from an empty directory, you have completed the lesson.
What we built
We created one independent Go module, wrote an executable main package, printed a message with fmt.Println and ran the code from the command line. The program is deliberately small; every step can be repeated and checked.
Next: This is the first published lesson in the GearDesk series. The next lesson will model the lab equipment as Go values.



