Stage 1 · Code
Programming Foundations (Go)
Start from your first line of Go and grow into a confident programmer who can build, test, and ship useful tools.
Prerequisite
None — start here if you've never written a program.
What this course leaves you with
- Read and write real programs in Go
- Understand functions, types, and control flow
- Ship your first command-line tool
Why this stage matters — You can write code — now solve hard algorithmic problems.
Progress
0 of 49 lessons complete. Progress is stored locally in your browser so you can pick the path back up later.
course completion
Getting Started
Set up the Go toolchain and learn the basic workflow for writing and running programs.
- 01What Programming IsUnderstand source code, compilers, interpreters, terminals, and how Go turns instructions into programs.6 min
- 02Installing GoInstall Go with the official installer, verify GOPATH and GOROOT, and check your setup with go version.6 min
- 03Hello, WorldCreate package main, import fmt, define func main, and print output with fmt.Println.5 min
- 04go run and go buildUse go run for quick feedback, go build for binaries, and understand where executables are written.7 min
- 05The Go ToolchainExplore gofmt, go doc, go env, go help, and the standard commands every Go developer uses daily.7 min
- 06Editor SetupConfigure VS Code or GoLand with gopls, formatting on save, diagnostics, and integrated terminal tasks.6 min
Variables, Types & Control Flow
Learn how Go stores values, makes decisions, and repeats work with predictable syntax.
- 01Declaring VariablesUse var, short declarations, assignment, scope, and naming conventions in small Go programs.6 min
- 02Basic TypesWork with string, bool, int, float64, rune, byte, and explicit conversions between numeric types.7 min
- 03Constants & Zero ValuesUse const, iota, untyped constants, and Go zero values for safe default initialization.7 min
- 04Operators & ExpressionsCombine arithmetic, comparison, logical, and string operators while avoiding integer division surprises.6 min
- 05if and switchWrite if statements, initialization clauses, switch cases, fallthrough, and type-free condition checks.7 min
- 06for LoopsUse counted loops, while-style loops, range loops, break, continue, and nested iteration.7 min
Functions & Composite Types
Organize behavior with functions and model data with Go's core collection types.
- 01Defining FunctionsDeclare functions with parameters, return values, package-level visibility, and clear call sites.6 min
- 02Multiple ReturnsReturn values and errors together, use named returns carefully, and ignore results with the blank identifier.7 min
- 03Arrays & SlicesCompare arrays and slices, use append, len, cap, slicing expressions, and copy safely.8 min
- 04MapsCreate map keys and values, check presence with comma ok, delete entries, and range over unordered data.7 min
- 05StructsDefine structs, initialize fields, embed structs, and model records without classes.7 min
- 06Data Modeling PracticeBuild a small contact list using slices, maps, structs, helper functions, and table-driven examples.8 min
Methods, Interfaces & Errors
Connect data and behavior while handling failure in idiomatic Go.
- 01PointersUse pointer values, address operators, dereferencing, nil checks, and mutation through shared references.8 min
- 02MethodsAttach methods to types, choose value or pointer receivers, and design simple APIs around structs.7 min
- 03InterfacesDefine small interfaces, satisfy them implicitly, and use io.Reader and fmt.Stringer as real examples.8 min
- 04Error ValuesCreate errors with errors.New and fmt.Errorf, wrap with %w, and inspect failures with errors.Is.8 min
- 05panic and recoverUnderstand when panic is appropriate, how defer runs, and why recover is not normal control flow.6 min
- 06Interface PracticeWrite a logger and storage abstraction using interfaces, mock implementations, and explicit error returns.8 min
Packages, Modules & Concurrency Intro
Structure larger programs, reuse standard libraries, and meet Go's concurrency model.
- 01Packages & ImportsSplit code into packages, use exported identifiers, organize internal folders, and avoid import cycles.7 min
- 02Go ModulesCreate go.mod with go mod init, add dependencies, tidy modules, and read go.sum checksums.8 min
- 03Standard Library TourUse strings, strconv, time, os, io, net/http, and encoding/json for everyday programming tasks.8 min
- 04GoroutinesStart concurrent work with go statements, observe scheduling, and wait safely with sync.WaitGroup.7 min
- 05ChannelsSend and receive values, close channels, range over results, and avoid deadlocks in small programs.8 min
- 06Concurrency BoundariesUse context.Context, cancellation, timeouts, and the race detector with go test -race.8 min
Your First Real Program
Build a practical command-line application from input parsing through release-ready binary.
- 01CLI Project PlanDesign a task tracker CLI with commands, flags, files, and a minimal package structure.6 min
- 02Reading InputRead command-line arguments with os.Args, scan stdin with bufio.Scanner, and validate user input.7 min
- 03Working with FilesUse os.ReadFile, os.WriteFile, file permissions, paths, and error handling for local persistence.8 min
- 04JSON StorageSerialize structs with encoding/json, handle MarshalIndent, Decode, field tags, and corrupt data errors.8 min
- 05Unit Testing BasicsWrite tests with testing.T, table-driven cases, temporary directories, and go test ./....8 min
- 06Build & Ship a BinaryCompile with go build, set GOOS and GOARCH, add version flags, and distribute a single executable.7 min
Testing & Debugging in Go
Use Go's testing, debugging, profiling, and logging tools to find defects quickly.
- 01Subtests, Coverage & BenchmarksUse go test with t.Run, -coverprofile, go tool cover, and benchmark functions for measurable feedback.8 min
- 02Table-Driven TestsStructure test cases with input structs, expected values, names, helpers, and clear failure messages.7 min
- 03Delve DebuggerDebug Go programs with dlv breakpoints, stack frames, variables, goroutines, and conditional stepping.8 min
- 04Race DetectorFind unsafe shared memory with go test -race, sync.Mutex, atomic operations, and reproducible concurrency tests.7 min
- 05pprof BasicsCollect CPU, heap, goroutine, and block profiles with net/http/pprof and go tool pprof.8 min
- 06Debugging With LogsUse log/slog fields, levels, request IDs, and temporary trace points without hiding root causes.6 min
Capstone — Ship a Real Tool
Design, build, release, and document a small Go service or command-line tool.
- 01Capstone ScopeChoose an HTTP JSON service or CLI, define users, commands, endpoints, data shapes, and acceptance checks.6 min
- 02Project LayoutOrganize cmd, internal packages, tests, go.mod, Makefile targets, and simple build scripts.7 min
- 03Flags & Environment ConfigLoad configuration with flag, os.LookupEnv, defaults, validation, and clear startup error messages.7 min
- 04Graceful ShutdownHandle os.Signal, context cancellation, http.Server Shutdown, worker cleanup, and timeout budgets.8 min
- 05Cross-Compile ReleasesBuild release binaries with GOOS, GOARCH, ldflags version metadata, checksums, and archive names.7 min
- 06Publish & DistributeTag a GitHub release, automate it with Actions, and let users install via go install or a Homebrew tap.8 min
- 07README for ToolsDocument install steps, usage examples, configuration, troubleshooting, and release notes for real users.6 min