Introduction to Go
Discover what the Go programming language is, its origins at Google, its strengths for cloud and network services, and the traits that define it.
Every lesson to learn Go, from your first program to interfaces and error handling, organised by level.
Discover what the Go programming language is, its origins at Google, its strengths for cloud and network services, and the traits that define it.
A step-by-step guide to installing Go on Windows, macOS and Linux, verifying the setup with go version, and understanding modules and workspaces.
Create a Go module, write a runnable Hello World in main.go, then run and build it while learning package main, imports and the func main entry point.
Learn how to declare and use variables in Go with var, the short := operator, type inference and zero values, with runnable examples.
Learn to control the flow of a Go program with if, else if and else, the if-with-statement form, and switch, with clear runnable examples.
Master Go's only loop keyword, for: the three-component form, while-style and infinite loops, for range over slices and maps, plus break, continue and labels.
Learn to write functions in Go: parameters and typed returns, multiple and named return values, variadic functions, closures, and the result-error convention.
Understand arrays and slices in Go: slice literals, len and cap, append, slicing, make, ranging, and how slices share a backing array.
Learn how to create and use maps in Go: literals and make, the comma-ok idiom, delete, len and ranging over keys, with a runnable word-count example.
Learn to define structs in Go, use fields and struct literals, embed structs, and write value and pointer receiver methods, with a runnable example.
Learn how interfaces work in Go: implicit satisfaction, the empty interface any, type assertions, and a Stringer example, with runnable code.
Learn idiomatic error handling in Go: the error interface, returning and checking errors, errors.New, wrapping with %w, errors.Is and errors.As.