The Complete Go Learning Guide
Go (also called Golang) is a compiled, statically typed programming language designed for clear software and efficient tools. It is popular for network services, cloud systems, and command-line programs.
How Go works
The Go compiler turns source files into an executable. Go uses packages to group code, has a built-in garbage collector, and includes language features for concurrent tasks.
What you will learn
You will progress from a first executable through functions, structs, slices, maps, packages, errors, concurrency, and practical projects.
How to use this guide
- Start with Chapter 1 and move through the chapters in order. New ideas build on the earlier ones.
- Type each example yourself, make a small change, and predict what will happen before running it.
- When a chapter is ready, its lesson will appear at the chapter link. These pages are currently blank lesson starters.
A step-by-step learning path
- Chapters 1-7: Learn to write Go programs. Run a program, use values and types, work with input and output, control repetition, and write functions.
- Chapters 8-12: Work with collections and data. Use arrays, slices and maps, process text, understand pointers, manage resources, and define structs and interfaces.
- Chapters 13-18: Organize practical tools. Learn visibility, packages and modules, the standard library, files, error handling, debugging, and tests.
- Chapters 19-24: Build reliable programs. Study algorithms, advanced Go features, concurrency and performance, build workflows, and guided projects.
Go ideas you will meet early
- Package: a group of related Go source files. A runnable program uses the
mainpackage and starts in itsmainfunction. - Short declaration:
:=creates and initializes a local variable, for examplename := "Ada". - Slice: a flexible view of a sequence of values. A map stores values under keys.
- Error value: many Go functions return an error as a result. Programs usually check that result and decide what to do if it is not
nil.
Your first Go program
Save this program as hello.go:
package main
import "fmt"
func main() {
fmt.Println("Hello, world!")
}
package main marks this as a runnable program. The fmt package provides formatted input and output. Execution starts in main, and fmt.Println writes text followed by a new line. With Go installed, run it from the file's folder:
go run hello.go
Go's formatter can keep source code consistent. As your program grows beyond one file, use a Go module to describe the project and its dependencies.
A simple way to study
- Check every returned error instead of assuming an operation succeeded.
- Format code with
gofmtand learn the package name at the top of each source file. - Try
go testwhen you begin adding tests to a package. - Learn concurrency gradually; goroutines and channels are useful tools, but they do not remove the need to reason about shared data.
First file: save your first program as hello.go and run it with go run hello.go.
Course chapters
Follow the 24 chapters in order, or choose a topic to revisit. Each chapter opens its own lesson page.
- What Go is and how a program runs
- Your first program
- Values, types, and variables
- Input and output
- Expressions and operators
- Decisions and loops
- Functions and program structure
- Collections: arrays, lists, and slices
- Strings and text
- References, pointers, and memory
- Memory and resource management
- User-defined types and data modeling
- Scope, lifetime, and visibility
- Modules, imports, and declarations
- Multi-file programs, packages, and libraries
- The standard library and ecosystem
- File input and output
- Errors, debugging, and testing
- Data structures and algorithms
- Advanced language topics
- Safety, portability, and performance
- Build systems and professional workflow
- A project ladder
- Further study checklist