01 · Basics of language
The foundation: packages, variables, types, constants, operators and input/output with the fmt package.
- var / := / const
- zero value
- iota
- fmt.Printf
End of the Go Course
Congratulations! You have completed all 10 modules and 50 lessons of the Go course — from var and := fundamentals to slice backing arrays, goroutines, channels, select, context, table-driven tests, generics, and net/http services. Review the map below and tackle the 5-step final challenge.
10 modules · 50 lessons · 250 checkpoints
Go exercises are verified locally in the browser using Tree-sitter AST parsing (`tree-sitter-go.wasm`) plus structural and keyword checks; for live compilation with the official Go toolchain, click Open on Go Playground (go.dev/play).
The foundation: packages, variables, types, constants, operators and input/output with the fmt package.
Decisions and repetitions: if with init statements, the unique `for`, idiomatic switch and explicit error handling.
Functions as first class citizens: signature, multiple returns, variadic parameters, closure and `defer`.
Array, slice (the most important structure), map, rune in strings and sorting.
Composite data types: struct, methods on receiver value or pointer, composition (no inheritance) and tag.
Structural interfaces (no explicit implementations), assertion, type switches and the standard `Stringer` and `error` interfaces.
The concurrency model of Go: goroutine read, channel for communication, `select`, sync and context.
The packages you will use every day: fmt, strings, strconv, io, os, time, encoding/json.
The `go test` tool, table-driven testing, benchmarking, dependency management with `go mod` and build tags.
Naming, advanced error handling, generics (Go 1.18+) and two mini-projects: CLI and server HTTP.
Put idiomatic Go into practice across five progressive stages: FilterEvens over slices, CountWords over maps, CountWordsHandler with net/http + encoding/json, MapSlice[T, U any] + %w error wrapping with errors.Is, and a bounded RunPool with goroutines and sync.WaitGroup.
Implement FilterEvens(nums []int) []int using make([]int, 0, len(nums)) and for-range iteration (Module 4 + Module 2).
Define func FilterEvens(nums []int) []int returning a new slice with only even integers from nums in original order, using for _, n := range nums, n%2 == 0, and append.
Initialize out := make([]int, 0, len(nums)) and inside for _, n := range nums check if n%2 == 0 { out = append(out, n) }.
Solution available after 3 attempts
Implement CountWords(text string) map[string]int using strings.Fields and an initialized map (Module 8 + Module 4).
Define func CountWords(text string) map[string]int splitting text with strings.Fields, allocating out := make(map[string]int), and incrementing out[w]++ in a for-range loop.
Never write to a nil map: allocate out := make(map[string]int) first, then range over strings.Fields(text).
Solution available after 3 attempts
Build CountWordsHandler(w http.ResponseWriter, r *http.Request), setting Content-Type before encoding JSON (Module 10 + Module 8).
Implement func CountWordsHandler(w http.ResponseWriter, r *http.Request) reading r.URL.Query().Get("q"), setting "Content-Type" to "application/json", and encoding CountWords(q) via json.NewEncoder(w).Encode.
Always invoke w.Header().Set("Content-Type", "application/json") BEFORE calling json.NewEncoder(w).Encode(CountWords(q)).
Solution available after 3 attempts
Combine type parameter [T, U any] transformation with wrapped sentinel errors inspectable via errors.Is (Module 10 + Module 6).
Define generic MapSlice[T, U any](items []T, fn func(T) U) []U using make([]U, len(items)), plus ParsePort(raw string) (int, error) wrapping ErrInvalidPort with fmt.Errorf("%w").
In MapSlice loop for i, v := range items { out[i] = fn(v) }; in ParsePort return 0, fmt.Errorf("parse port %q: %w", raw, ErrInvalidPort) on error.
Solution available after 3 attempts
Coordinate multiple goroutines reading typed jobs and closing the output channel safely after completion (Module 7).
Complete RunPool(jobs []int, workers int) []int spawning workers goroutines synchronized with sync.WaitGroup that square each job from chJobs into chResults and close chResults once wg.Wait() returns.
Fill chJobs := make(chan int, len(jobs)) then close(chJobs); call wg.Add(1) + go func() { defer wg.Done() ... }() and close(chResults) in a waiter goroutine after wg.Wait().
Solution available after 3 attempts
Complete quick reference covering Go types, zero values, slices, maps, interfaces, goroutines, stdlib, testing, and generics.
The fastest way to solidify Go is hands-on building: open the Go Playground or run `go mod init` locally to combine CLI flags, worker concurrency, and an HTTP endpoint into a complete service.