Go Tutorial
Learn Go 1.27 from your first program to goroutines, generics, iterators, testing, web servers and real projects. 147 lessons with Go that compiles and runs in your browser, quizzes and projects.
Start learning →
of lessons completed
Getting Started
- Getting Started with Go Learn what Go is, why Google created it, where it is used, and run your first Go program in the browser. A friendly start to the Go (Golang) programming language.
- How Go Works: Compiling and Running Understand how Go turns source code into a fast static binary - go run vs go build vs go install, cross-compiling, the runtime, the scheduler and garbage collector.
- Go Syntax Learn the rules of Go syntax - the package clause, imports, declarations, automatic semicolons, brace placement, exported names, gofmt, and how to read compiler errors.
- Comments and Documentation Learn Go comments - line and block comments, doc comments that become documentation, package comments, Deprecated markers, TODO conventions and special directives.
- Printing with fmt Master printing in Go with fmt - Println, Print, Printf, Sprintf and Fprintf, every common verb (%v %+v %#v %T %d %s %q %x %f), width, precision, flags and os.Stderr.
- Reading Input Learn to read input in Go with bufio.Scanner, bufio.Reader, fmt.Scan and Sscanf, convert text to numbers safely with strconv, handle EOF, and use the Input box.
- The go Command and Basic Tooling Learn the everyday Go tools - go fmt, go vet, go doc, go env, go version and go help, plus gopls, editors, golangci-lint and a simple daily workflow.
Variables and Types
- Variables and Zero Values Learn Go variables - var and :=, multiple assignment, the blank identifier, zero values for every type, redeclaration and scope, with runnable examples.
- Constants and iota Learn Go constants - const, typed versus untyped constants, arbitrary-precision constant math, iota enums, bit flags and constant expressions.
- Basic Types A tour of Go basic types - bool, sized and unsigned integers, byte and rune, floats, complex numbers, strings, unsafe.Sizeof and overflow wraparound.
- Numbers and Math Work with numbers in Go - integer division, overflow, float precision, NaN and Inf, the math package, math/big, math/bits and parsing numbers with strconv.
- Strings, Bytes and Runes Understand Go strings as immutable UTF-8 bytes - len versus rune count, indexing, ranging over runes, []byte and []rune conversion, raw strings and escapes.
- Type Conversion and Inference Learn Go type conversion - no implicit conversions, numeric truncation, strconv for strings and numbers, type inference with := and defined types vs aliases.
- Defined Types and Type Aliases Learn Go defined types and aliases - type X int versus type X = int, underlying types, methods, generic type aliases (Go 1.24) and enum-like types.
Operators and Control Flow
- Operators Learn every Go operator - arithmetic, comparison, logical with short-circuiting, bitwise (including &^), assignment operators, ++ and --, precedence, and why there is no ternary.
- if, else if and else Learn Go's if statement - conditions without parentheses, else if chains, the init statement and its scope, early returns, and the comma-ok idiom for maps.
- switch Learn Go's switch statement - cases without break, multiple values per case, tagless switch for ranges, init statements, fallthrough, break inside loops and a first look at type switches.
- for Loops Learn Go's single loop keyword - the three-clause for, while-style and infinite loops, range over integers, break and continue, and the per-iteration loop variables introduced in Go 1.22.
- Ranging Over Collections Learn how Go's range clause iterates over slices, arrays, strings, maps, channels, integers and iterator functions, including copy semantics, random map order and modifying data while looping.
- Labels, break, continue and goto Learn how Go labels let break and continue control nested loops, switch and select, and when the rarely used goto statement is acceptable, including its compile-time restrictions.
Functions
- Functions Learn Go functions from the ground up - syntax, parameters and results, grouped types, functions as values, pass-by-value, exported names, and how init and main run.
- Multiple Return Values and Named Results Learn how Go functions return several values, the (value, error) convention, named results, naked returns and why they are risky, and how to ignore values with the blank identifier.
- Variadic Functions Learn Go variadic functions - the ...T parameter, calling with zero or many arguments, spreading a slice with ..., how fmt.Println uses ...any, and the aliasing pitfall.
- Anonymous Functions and Closures Learn Go function literals and closures - capturing variables, counters and generators, the per-iteration loop variable change in Go 1.22, function types, callbacks and immediately invoked functions.
- defer Learn Go's defer statement - last-in-first-out order, when arguments are evaluated, cleanup of files and locks, defer in loops, changing named results, cost and panics.
- Recursion Learn recursion in Go - base and recursive cases, factorial, Fibonacci, Towers of Hanoi, permutations, growable goroutine stacks, missing tail-call optimization and memoization.
- Functions as Values and Higher-Order Functions Learn higher-order functions in Go - passing and returning functions, function types with methods, middleware-style wrappers, generic map, filter and reduce, and a preview of the options pattern.
Collections
- Arrays Learn Go arrays - why the size is part of the type, value semantics and copying, [...]T literals, indexing and bounds checks, comparing arrays, multi-dimensional arrays and when to use them.
- Slices Learn Go slices - how they differ from arrays, literals, len and cap, append, slicing expressions, nil versus empty slices, make, copy, 2D slices, inserting and deleting items, clear, min and max.
- How Slices Work: Length, Capacity and Aliasing Understand the Go slice header, how append grows capacity, why slices share memory and cause surprising bugs, full slice expressions, memory leaks from reslicing, and how to preallocate.
- Maps Learn Go maps from scratch - literals and make, the comma-ok lookup, delete, random iteration order, nil map panics, sets with map[T]struct{}, counting and grouping idioms, and concurrency limits.
- The slices and maps Packages Master Go's slices, maps and cmp packages - Sort, SortFunc, BinarySearch, Contains, Index, Compact, Insert, Delete, Clone, Collect, Sorted, maps.Keys, maps.DeleteFunc, cmp.Compare and cmp.Or.
- Sorting Learn to sort in Go - sort.Ints and sort.Slice, slices.SortFunc with cmp, multi-key sorting, stable sorts, the sort.Interface, reverse order, sorting maps by value and binary search with sort.Search.
- Working with Strings: strings, strconv and unicode Learn Go string handling - strings.Builder, Split, Join, Fields, Trim, Replace, Cut, EqualFold, Lines and SplitSeq, strconv Atoi and ParseFloat, Quote, and unicode checks, with efficiency tips.
- Bytes, Buffers and Readers Learn Go byte slices, the bytes package, bytes.Buffer, strings.Reader, bufio.Reader and Writer, and the io.Reader and io.Writer interfaces that let you stream and build data efficiently.
Pointers and Memory
- Pointers Learn Go pointers from scratch - the & and * operators, nil pointers and panics, pointers to structs, comparing pointers, new(T) and new(expr) in Go 1.26, and when to use them.
- Pointers, Values and Functions Go always passes arguments by value. See how pointers let functions modify data, why returning a pointer to a local is safe, and how slices, maps and channels behave as parameters.
- new, make and Composite Literals Understand the difference between new and make in Go, how composite literals and &T{} create values, why zero values are useful, and how NewX constructor functions fit in.
- Stack, Heap and Escape Analysis Learn where Go values live, how the compiler decides between stack and heap with escape analysis, how to read -gcflags=-m output, and how to measure and reduce allocations.
- Garbage Collection and Memory How Go's concurrent garbage collector works, how GOGC and GOMEMLIMIT tune it, how to read runtime.MemStats, and how cleanups, weak pointers and leaks behave in modern Go.
Structs and Methods
- Structs Learn Go structs - declaring types, named-field literals, zero values, nested and anonymous structs, comparing and copying, struct tags, and exported versus unexported fields.
- Methods Learn Go methods - how to declare them with receivers, put methods on any defined type, use method values and expressions, compare methods with functions, and understand method sets.
- Value vs Pointer Receivers Learn when a Go method needs a pointer receiver and when a value receiver is enough - mutation, copying cost, method sets, map elements and interface satisfaction.
- Struct Embedding and Composition Learn Go struct embedding - promoted fields and methods, shadowing, embedding interfaces and pointers, initializing embedded types, and composition over inheritance.
- Constructors, Options and Builders Learn how Go creates objects - NewX functions, validating invariants, the functional options pattern, config structs, builders and making the zero value useful.
- Struct Tags Learn Go struct tags - the key:"value" syntax, json and xml tags, omitempty and the dash, omitzero, reading tags with reflect, and writing your own validation tags.
- Struct Memory Layout and Alignment Learn how Go lays out structs in memory - sizes and alignment of types, padding, unsafe.Sizeof and Offsetof, reordering fields to save space, and the empty struct.
- Object-Oriented Programming in Go Map classes, objects, encapsulation, inheritance and polymorphism onto Go - structs with methods, exported fields, embedding instead of inheritance, and interfaces for polymorphism.
Interfaces
- Interfaces Learn Go interfaces from scratch - implicit satisfaction, method sets, small interfaces, interface values, polymorphism, composing interfaces and io.Reader and io.Writer.
- The Empty Interface and any Learn Go's empty interface and the any alias - storing mixed values, type assertions with the comma-ok form, type switches, JSON decoding into any, and why to avoid it.
- Type Assertions and Type Switches Learn Go type assertions and type switches - the x.(T) forms, the comma-ok idiom, panics, multi-type cases, nil handling and the optional interface upgrade pattern.
- Common Standard Interfaces Tour the Go interfaces you will implement most - fmt.Stringer, error, io.Reader, io.Writer, io.Closer, sort.Interface, http.Handler, json.Marshaler and flag.Value.
- Interface Internals and the nil Trap Understand how Go stores interface values as a (type, value) pair, why an interface holding a nil pointer is not nil, how interfaces compare, what dynamic dispatch costs and how embedding works.
- Designing with Interfaces Learn how to design with Go interfaces - keep them small, define them where they are used, test with hand-written fakes, inject dependencies without frameworks and avoid interface pollution.
Generics
- Generics: Type Parameters Learn Go generics from scratch - why they were added in 1.18, generic functions, type parameters, type inference, multiple type parameters, instantiation and generic Map, Filter and Reduce.
- Constraints and Type Sets Learn Go type constraints - any, comparable, cmp.Ordered, custom constraint interfaces with unions and the ~T tilde, type sets, methods in constraints and the pointer-receiver pattern.
- Generic Types and Methods Learn Go generic types - generic structs like Stack[T] and Cache[K, V], methods on generic types, constructors, zero values of T, generic type aliases from Go 1.24 and the generic methods added in Go 1.27.
- Generics in Practice: When to Use Them Learn when Go generics are the right tool and when interfaces or plain code are better - algorithms vs containers, performance, common mistakes and the slices and maps packages.
- Iterators: range over Functions Learn Go iterators from scratch - iter.Seq and Seq2, writing yield functions, early exit rules, lazy Filter/Map/Take pipelines, slices and maps helpers, iter.Pull, and iterators vs channels.
Errors
- Errors as Values Learn how Go handles errors - the error interface, errors.New and fmt.Errorf, returning and checking errors, the if err != nil idiom, sentinel errors like io.EOF and when to ignore an error.
- Wrapping and Inspecting Errors Learn how to add context to Go errors with fmt.Errorf and %w, inspect error chains with errors.Is, errors.As and errors.Unwrap, combine errors with errors.Join, and decide when not to wrap.
- Custom Error Types Learn to build custom error types in Go - struct errors with fields, pointer vs value receivers, Is, As and Unwrap methods, error codes and the typed nil pitfall that makes err != nil true.
- panic and recover Learn what panic does in Go, which runtime errors cause panics, how recover works inside deferred functions, when to re-panic, how to turn panics into errors, and how os.Exit and log.Fatal differ.
- Error Handling Patterns Practical Go error handling patterns - handle or return but never both, log once, retry with backoff, collect errors from goroutines, clean up with defer, Must helpers and an error-collecting writer.
Concurrency
- Goroutines Learn Go goroutines - the go keyword, how they differ from threads, why main must wait, sync.WaitGroup and wg.Go, loop variables, goroutine leaks and concurrency versus parallelism.
- Channels Learn Go channels - make(chan T), blocking sends and receives, unbuffered rendezvous, close and range, receiving from closed channels, nil channels, directions and deadlocks.
- Buffered Channels and select Learn buffered channels, backpressure and the Go select statement - multiple cases, default, timeouts with time.After, tickers, select loops, nil channels and fan-in.
- The sync Package Learn Go's sync package - Mutex and RWMutex for shared state, Once, OnceFunc and OnceValue, Cond, sync.Map and sync.Pool, plus copied locks, lock granularity and deadlocks.
- Atomic Operations Learn Go's sync/atomic package - atomic.Int64, Bool and Pointer[T], Add, Load, Store, Swap and CompareAndSwap, CAS loops, atomics versus mutexes and Go's memory ordering.
- The context Package Learn Go's context package - Background and TODO, WithCancel, WithTimeout, WithDeadline, WithValue, ctx.Done and Err, cancellation propagation, Cause, AfterFunc and best practices.
- Concurrency Patterns - Pipelines, Worker Pools, Fan-out Learn Go concurrency patterns with runnable code - generators, pipelines, worker pools, fan-out and fan-in, semaphores, rate limiting, an errgroup-style helper and bounded parallelism.
- Data Races and the Memory Model Learn what a Go data race is, why counter++ loses updates, how mutexes, atomics and channels fix it, the happens-before rules of the memory model and how to use go run -race.
- Time, Timers and Tickers Learn Go's time package - Duration, Time values, the 2006-01-02 layout, parsing, time zones, the monotonic clock, Sleep, Timer, Ticker, AfterFunc and how to keep time-based code testable.
- Testing Concurrent Code Learn to test goroutines, channels and timers in Go without flaky sleeps - deterministic waits, testing/synctest with a fake clock, goroutine leak checks and running the race detector in CI.
- Rate Limiting and Backpressure Build rate limiters in Go from scratch - a token bucket with an injectable clock, per-client HTTP limits with 429 and Retry-After, bounded queues, load shedding and context-aware semaphores.
Standard Library
- fmt in Depth: Formatting and Scanning Master Go's fmt package - every Printf verb and flag, width and precision, argument indexes, Stringer, GoStringer and Formatter, Sscanf and Fscan, and aligned tables with text/tabwriter.
- Math and Random Numbers Use Go's math package, understand NaN, Inf and float precision, generate repeatable random numbers with math/rand/v2 (PCG, ChaCha8), pick secure values with crypto/rand and compute simple statistics.
- os, io and bufio Learn Go's io.Reader and io.Writer, helpers like Copy, TeeReader, MultiWriter and Pipe, buffered I/O with bufio.Scanner and Writer, and the os package for arguments, environment, files and exit codes.
- Files, Directories and Paths Learn to create, open, read and write files in Go, list and walk directories, build portable paths with path/filepath, use io/fs and embed, set permissions and confine access with os.Root.
- JSON Learn encoding/json in Go - Marshal and Unmarshal, struct tags, omitempty and omitzero, decoding into maps and any, Decoder and Encoder, RawMessage, custom marshalers and the new json/v2.
- CSV, XML and Other Encodings Read and write CSV with encoding/csv, XML with encoding/xml, Go-only data with gob, and convert bytes with base64, hex and encoding/binary. Includes text versus binary format trade-offs.
- Regular Expressions Learn Go regular expressions with the regexp package - RE2 syntax, MatchString, Find and FindAll, capture groups, named groups, ReplaceAllString, flags, compiling once and what RE2 cannot do.
- Templates: text/template and html/template Learn Go templates - actions, pipelines, range, if and with, variables, custom functions, nested templates with define and block, and why html/template auto-escaping protects against XSS.
- Logging with log and slog Learn logging in Go with the log package and structured log/slog - levels, attributes, groups, text and JSON handlers, ReplaceAttr, custom handlers, LogValuer and logging best practices.
- Command-Line Programs: flag and os.Args Build command-line tools in Go with os.Args and the flag package - typed flags, usage text, custom flag types, subcommands with FlagSet, exit codes and environment variables, testable in the editor.
- Hashing and Cryptography Use Go's standard library for hashing and cryptography - SHA-256 and SHA-3, HMAC, secure random numbers, AES-GCM encryption, PBKDF2, constant-time comparison, fnv and maphash, and what not to build yourself.
- URLs and Network Basics Parse and build URLs with net/url, handle query strings and escaping, check IP addresses and CIDR ranges, and write a TCP echo server and client on loopback.
- Unicode and Text Processing Handle Unicode text in Go - the unicode and utf8 packages, invalid UTF-8, combining marks, bufio.Scanner splitters, text/scanner and strings.NewReplacer.
- Running Commands with os/exec Learn how to run external programs from Go with os/exec - capture output, check exit codes, feed stdin, build pipelines, stream output and stop commands with context timeouts.
- container/heap, list and ring Use Go's container packages - build priority queues with container/heap, linked lists with container/list and circular lists with container/ring, with runnable examples.
- Embedding Files with go:embed Learn how go:embed bundles files and directories into a Go binary - string, []byte and embed.FS variables, patterns, templates, static assets with http.FS, and common mistakes.
- archive/zip, tar and compress/gzip Create and read zip and tar archives in Go, compress data with gzip and zlib, stream files safely, and avoid zip-slip and decompression-bomb problems, with runnable examples.
- math/big: Big Integers, Rationals and Floats Do arbitrary-precision arithmetic in Go with math/big - big.Int, big.Rat and big.Float, the receiver pattern, factorials, Fibonacci, modular math, primes and exact fractions.
Modules and Packages
- Packages and Visibility Learn how Go packages work - package versus directory, exported and unexported names, imports and aliases, init order, internal packages and naming.
- Go Modules Understand Go modules - go.mod and go.sum, go mod tidy and get, semantic import versioning, replace and toolchain, GOPROXY and version selection.
- Project Layout and Multi-File Programs Organize Go projects - multi-file packages, cmd and internal directories, build constraints, go:generate, go:embed, file name suffixes and go.work workspaces.
- Working with Third-Party Packages Choose, add, upgrade and audit third-party Go packages - finding libraries, judging quality, go get, govulncheck, licenses, vendoring and popular libraries.
- go generate, Workspaces and Vendoring Go beyond the basics of go generate, go.work and vendor - directive variables, writing AST-based generators, freshness checks in CI, multi-module workspaces and the vendor directory.
Testing and Tooling
- Testing with the testing Package Write Go tests with the testing package - _test.go files, t.Error and t.Fatal, helpers, cleanup, TempDir, subtests with t.Run and how to run them with go test.
- Table-Driven Tests and Testable Design Learn table-driven tests in Go - subtests with t.Run, helpers, parallel cases, golden files, fakes behind interfaces, httptest handlers and a fake clock for time-dependent code.
- Benchmarks and Fuzzing Measure Go code with testing.B and b.Loop, read ns/op and allocs/op, compare runs with benchstat, find bugs with native fuzzing and keep documented examples verified as tests.
- Profiling and Debugging Find slow and broken Go code with printf debugging, panic traces, runtime.Stack, pprof CPU and heap profiles, runtime/trace, the Delve debugger and GODEBUG settings.
- go vet, gofmt and Linting Catch Go bugs before they run - what go vet reports, how gofmt and goimports format code, what staticcheck and golangci-lint add, plus a CI setup you can copy and a mini linter built on go/ast.
- Documentation and Examples Write Go documentation that tools understand - doc comment syntax, doc.go, runnable examples, go doc and pkg.go.dev, README and CHANGELOG habits, and how to keep an API stable across versions.
- Build Tags, Cross-Compilation and ldflags Learn how Go chooses files with //go:build constraints and file name suffixes, how to cross-compile with GOOS and GOARCH, stamp versions with -ldflags -X, and shrink binaries.
Web and Networking
- Building an HTTP Server Build a web server with Go's net/http - Handler and HandlerFunc, ServeMux method and wildcard patterns, requests and responses, status codes, headers, timeouts and graceful shutdown.
- Handlers, Routing and Middleware Structure Go web handlers properly - error-returning handlers, middleware chains for logging, panic recovery, request IDs and auth, context values, query and form parsing, JSON handlers and httptest.
- The HTTP Client Learn the Go HTTP client with net/http - Get, Post and Do, custom timeouts, request building, JSON bodies, closing response bodies, connection reuse and safe retries.
- Building a JSON REST API Build a JSON REST API in Go with net/http - resources and routes, JSON helpers, validation, status codes, pagination, a mutex-protected store and handler, service and store layers.
- Streaming, SSE and WebSockets Stream HTTP responses in Go with http.Flusher, build Server-Sent Events, long polling and a broadcast hub with backpressure, and learn how WebSockets work and which libraries to use.
- TCP Servers and Custom Protocols Build TCP servers in Go with net.Listen and Accept, design a line protocol, add framing and deadlines, shut down gracefully and write the core of a multi-user chat server.
- RPC, gRPC and Protocol Buffers Learn remote procedure calls in Go with net/rpc and JSON-RPC, see how protobuf encodes data on the wire, and get a practical tour of gRPC, streaming, Connect and REST versus gRPC.
- Signals and Graceful Shutdown Shut Go servers down cleanly - handle SIGINT and SIGTERM with os/signal and signal.NotifyContext, drain requests with http.Server.Shutdown, stop workers and clean up resources.
- TLS and HTTPS in Go Learn how TLS works in Go with crypto/tls and net/http - certificates, trust pools, hostname checks, httptest TLS servers, mutual TLS (mTLS) and safe production settings.
- Authentication, Sessions and JWT in Go Build login in Go with the standard library - hash passwords with PBKDF2, keep users signed in with secure cookie sessions, issue and verify HS256 JWTs, and protect routes with middleware.
- Web Frameworks: Gin, Echo and chi Compare Gin, Echo and chi with Go's standard net/http - routing groups, middleware, request binding and validation - and see runnable net/http stand-ins for each idea.
- Sending Email with net/smtp Send email from Go with net/smtp - PlainAuth, SendMail, message headers, HTML and attachments with MIME multipart, and a local SMTP server you can run in the lesson to see the real conversation.
Databases
- Databases with database/sql Use Go's database/sql package - drivers, Open and Ping, Query, QueryRow, Exec and Scan, NULL handling, prepared statements, transactions, contexts and pool settings, plus a tiny driver you can run.
- SQL in Go: Repositories, Migrations and sqlc Organize SQL code in Go - the repository pattern, query builders versus raw SQL, sqlc and ORMs, schema migrations, testing with real databases, and avoiding N+1 queries and missing indexes.
- Caching and NoSQL from Go Cache and store data from Go - go-redis and MongoDB basics, plus runnable in-process caches - sync.Map, TTL expiry, a hand-built LRU, cache-aside and singleflight.
- GORM, sqlx and Query Builders Compare GORM, sqlx and SQL builders with plain database/sql - models, joins, preloading, pagination, concurrent queries, and Postgres versus MySQL differences, with runnable stand-ins.
Advanced Go
- Reflection Learn Go reflection - reflect.TypeOf and ValueOf, Kind, reading struct fields and tags, setting values, calling methods, a mini validator and encoder, and what it costs.
- unsafe, cgo and Assembly Learn what Go's unsafe package really offers - Sizeof, Offsetof, unsafe.String and Slice, pointer arithmetic and its rules - plus cgo, assembly and WebAssembly targets.
- The Go Scheduler and Runtime Internals Understand how Go runs goroutines - the G, M and P model, work stealing, preemption, the netpoller, blocking syscalls, stack growth and the runtime and runtime/debug packages.
- Performance Tuning Make Go programs faster the right way - measure first, then cut allocations with strings.Builder, preallocation, sync.Pool and fewer interface boxes. Includes inlining, bounds checks and PGO.
- Design Patterns and Idioms in Go See classic design patterns the Go way - functional options, strategy, observer with channels, factory, decorator and middleware, singleton with sync.Once, adapter, dependency injection and Go proverbs.
- Go Compared with Other Languages Compare Go with Java, C++, Python, Rust and Node.js on concurrency, errors, generics, memory and tooling - plus when Go is the wrong choice and how to migrate.
- What's New in Go 1.21 to 1.27 A release-by-release tour of Go 1.21 to 1.27 with runnable examples - built-ins, loop variables, iterators, generic aliases, WaitGroup.Go, new(expr), generic methods, json/v2 and GODEBUG.
- Retries, Timeouts and Circuit Breakers Make Go services survive flaky dependencies using only the standard library - deadlines, retries with exponential backoff and jitter, Retry-After handling and a circuit breaker state machine.
- Layered and Hexagonal Architecture in Go Structure Go programs with layers and hexagonal architecture - domain types, ports as small interfaces, adapters, a composition root and dependency injection without a framework.
- Containerizing and Deploying Go Apps Package a Go service in a tiny container with a multi-stage Dockerfile, a scratch or distroless image, health checks, graceful SIGTERM handling and environment-based configuration.
- Go and WebAssembly Compile Go to WebAssembly for the browser with GOOS=js and for servers with GOOS=wasip1. Learn syscall/js, wasm_exec.js, callbacks, wasmexport, size trade-offs and when it pays off.
Projects
- Project: Command-Line To-Do Manager Build a to-do manager in Go in four stages - a task store and command loop, flag parsing with FlagSet, JSON persistence to a file, and table-driven tests you can run.
- Project: Word Frequency Analyzer Build a word counter in Go in four stages - reading stdin, Unicode-aware tokenizing, counting with maps, ranking the top N, and a concurrent worker-pool version checked against the simple one.
- Project: Bank Account System Build a bank in Go in four stages - accounts with policies and custom errors, mutex-protected balances, deadlock-free transfers using lock ordering, and an audit ledger you can replay to verify.
- Project: URL Shortener Service Build a URL shortener in Go in four stages - JSON handlers and base-62 codes, custom codes with stats and middleware, a real server with graceful shutdown, and httptest-based tests.
- Project: Concurrent Web Crawler Build a web crawler in Go in four stages - breadth-first crawling of a simulated site, bounded concurrency with a mutex-protected visited set, context timeouts and cancellation, and a full report.
- Project: Key-Value Store with TCP Protocol Build a Redis-like key-value server in Go in four stages - a thread-safe store, a text protocol over TCP with a server, a client with key expiry using timers, and JSON snapshots with many clients.
- Project: Real-Time Chat Server Build a TCP chat server in Go step by step - a hub goroutine that owns all state, one goroutine per client, nicknames, rooms, commands and graceful shutdown.
- Project: A Small Markdown-to-HTML Converter Build a Markdown-to-HTML converter in Go in four stages: blocks, lists and code, inline formatting with regexp, then table tests and safe links.
Practice and Review
- Go Cheat Sheet A one-page Go cheat sheet: syntax, types, control flow, slices, maps, structs, interfaces, generics, errors, goroutines, go commands and fmt verbs.
- Go Programs: 50 Classic Examples 50 classic Go programs you can run: primes, Fibonacci, palindromes, Roman numerals, sorting algorithms, maps, structs, interfaces, generics, JSON and goroutines.
- Go Practice Exercises 30 graded Go exercises with solutions on loops, functions, strings, slices, maps, structs, interfaces, errors, generics and goroutines. Run Go in your browser.
- Data Structures from Scratch in Go Build four generic data structures in Go from scratch - a stack, a ring-buffer queue, a doubly linked list and a binary search tree - and check each with table-driven style tests.
- Go Interview Questions 49 common Go interview questions with answers: slices, maps, defer, interfaces, goroutines, channels, generics, the scheduler, garbage collection and memory.
- Go Project Ideas Thirty Go project ideas in four levels, from command-line tools to concurrent services and systems programming, each with an outline, the skills it trains and a runnable starting skeleton.