Go
Learn Go (Golang) for building fast, concurrent applications. Perfect for cloud services, microservices, and modern backend development.
Learn the Go programming language — syntax, types, functions, concurrency and more — with concise, beginner-friendly lessons.
Part of the free Go course at LearnCodingFast — hands-on lessons with examples you run in your browser, plus practice exercises and a quick quiz.
New to Go? It's simpler than you'd expect.
Start with Lesson 1 — Introduction to Go. Go is designed to be easy to learn and incredibly powerful for backend and cloud development.
Lessons in this course
- Introduction to Go — Why Go was created at Google, its strengths, and writing your first program
- Variables and Data Types — Go's type system — integers, floats, strings, booleans, and type inference with :=
- Data Types & Constants (iota) — Numeric types, strings, runes, constants and the iota enumerator
- Control Flow (if, switch) — if/else, switch, and Go's clean conditionals
- for Loops & range — Go's single loop keyword and ranging over collections
- Arrays — Fixed-size sequences and how they differ from slices
- Slices — Go's powerful dynamic views over arrays — append, copy, slicing
- Maps — Key-value collections — create, read, update, delete and check existence
- Pointers — Memory addresses, & and *, and when to use pointers
- Checkpoint: Go Basics — Combine slices, maps and loops in a build challenge — then a quiz
- Methods (value vs pointer receivers) — Attach behavior to types and choose the right receiver
- Interfaces — Go's implicit interfaces and duck typing
- Goroutines — Lightweight concurrency with the go keyword
- Channels — Communicate between goroutines — buffered, unbuffered, and close
- defer, panic & recover — Cleanup with defer, and Go's panic/recover error model
- Error Wrapping — Wrap errors with %w and inspect with errors.Is/As
- Generics (Type Parameters) — Write reusable code with type parameters and constraints
- Working with JSON — Marshal and Unmarshal structs with struct tags
- Modules & Packages — Organise code with go mod, packages and imports
- Checkpoint: A Small Program — Combine structs, JSON, goroutines and errors — then a quiz
- Functions and Methods — Define functions with multiple return values and attach methods to types
- Structs and Interfaces — Group related data with structs and write flexible code with interfaces
- Concurrency with Goroutines — Run code concurrently with goroutines and communicate safely using channels
- Error Handling — Go's explicit error return pattern and how to create custom error types
- Constants & iota — Typed and untyped constants, const blocks, and the iota enumerator for bit flags
- Strings & the strings Package — Immutable byte sequences, Split/Join/Replace, and efficient strings.Builder
- Runes, Bytes & UTF-8 — Why len() counts bytes, ranging yields runes, and []rune vs []byte
- Formatting with fmt (Printf, Sprintf) — Verbs like %d %s %v %+v %T %q, width/precision, and the Stringer interface
- Type Conversions & Assertions — Numeric conversions, strconv, type assertions with comma-ok, and type switches
- Struct Embedding & Composition — Promoted fields and methods, embedding interfaces, and composition over inheritance
- Slice Internals: append, copy, capacity — The ptr/len/cap header, how append grows, and shared-backing-array bugs
- Maps: sets, ordering & nested maps — Sets with struct{}, comma-ok, deterministic printing, and nested maps
- Sorting (sort & slices.Sort) — sort.Slice with a less func, stable sorts, and sorting structs by field
- Time & Dates (time package) — Durations, the reference layout 2006-01-02, parsing, and comparing times
- Regular Expressions (regexp) — MustCompile, FindStringSubmatch capture groups, and ReplaceAllString
- Checkpoint: Standard Library — Combine strings, sorting, maps and regexp in a build challenge — then a quiz
- select & Multiplexing Channels — Wait on multiple channels with select, default, and timeouts with time.After
- sync: WaitGroup, Mutex, Once — Coordinate goroutines and protect shared state safely
- The context Package — Cancellation and timeouts that propagate through your call tree
- Worker Pools & Pipelines — Bounded concurrency with a jobs channel, N workers, and a results channel
- HTTP Clients (net/http) — Build requests, set timeouts, read bodies, and decode JSON responses
- Building a REST API — Method-based routing, JSON encoding/decoding, status codes, and path values
- HTTP Middleware — Wrap handlers for logging, auth, and recovery, and chain them together
- File I/O (os, bufio, io) — Read and write files, scan line by line, and copy streams with io.Copy
- Custom Errors & errors.Is/As — Sentinel errors, custom error types, wrapping with %w, and inspecting chains
- Generic Constraints & Type Sets — comparable, constraints.Ordered, and custom constraints with type sets
- Embedding Files & Build Tags — Bundle assets into the binary with //go:embed and use build constraints
- Checkpoint: Building Services — Combine routing, middleware and JSON into a tested handler — then a quiz
- Building Web Services — Create HTTP servers and REST APIs using Go's standard library net/http
- Testing in Go — Write unit tests, table-driven tests, and benchmarks with the testing package
- gRPC and Protocol Buffers — Define services in .proto files and generate type-safe gRPC clients and servers
- Database Access with database/sql — Query and modify SQL databases with the stdlib pool, scanning and transactions
- Web APIs with the Gin Framework — Build fast JSON REST APIs with routing, binding and middleware in Gin
- Building CLIs with Cobra — Create commands, subcommands and flags for production-grade command-line tools
- Profiling & Benchmarking with pprof — Find bottlenecks with CPU, heap and goroutine profiles and go test -bench
- The Race Detector & Memory Model — Catch data races with go test -race and understand happens-before
- Generic Stdlib: slices, maps & cmp — Everyday Go 1.21+ generics — slices.Sort, maps.Keys, cmp.Or and your own
- Reflection with the reflect Package — Inspect types and struct tags at runtime — and when not to use reflection
- Tooling: go vet, fmt & golangci-lint — Format, vet and lint Go code and wire static analysis into CI
- Go Workspaces & Vendoring — Multi-module development with go.work, plus vendoring and reproducible builds