Go tutorials
54 articles · page 2 of 3Hand-written tutorials, ordered as a recommended learning path.
- 21 Generics Real-World Practical Go generics patterns for production code: type-safe collections, result types, repository layers, and functional helpers.
- 22 HTTP Middleware Build composable HTTP middleware in Go for logging, auth, rate limiting, and recovery using standard library patterns.
- 23 Race Detector Use Go's race detector to find and fix data races, plus tools and patterns for debugging concurrent programs effectively.
- 24 slog Logging Learn Go's slog package for structured, leveled logging with JSON output, custom handlers, and context-aware log enrichment.
- 25 Sync Primitives A practical guide to Go sync primitives including Mutex, RWMutex, WaitGroup, Once, and when to choose each over channels.
- 26 Table-Driven Tests Write clear, maintainable Go tests using table-driven patterns, test helpers, subtests, and cleanup functions.
- 27 Concurrency Patterns Master Go concurrency — goroutines, channels, select, WaitGroups, mutexes, and common patterns like fan-out/fan-in and worker pools.
- 28 Context Package Master Go's context package — cancellation, timeouts, deadlines, values, and how to propagate them through your application stack.
- 29 Error Handling Write idiomatic Go error handling — wrapping, sentinel errors, custom error types, errors.Is, errors.As, and patterns for clean error flows.
- 30 Interfaces Understand Go interfaces — implicit satisfaction, the empty interface, type assertions, interface composition, and real design patterns.
- 31 Testing Write effective Go tests — table-driven tests, subtests, test helpers, mocking with interfaces, benchmarks, and integration testing patterns.
- 32 build tags Use Go build tags to include or exclude files per OS, architecture, or custom condition. Learn the new //go:build syntax, common patterns, and how tags interact with the test runner.
- 33 Go Context Master Go's context package: propagate deadlines, cancel goroutines safely, and avoid leaks with practical patterns for HTTP, database, and pipeline code.
- 34 context How to use Go's context package effectively: cancellation, deadlines, propagation, request-scoped values, and the patterns that keep services responsive.
- 35 database/sql Use Go's standard database/sql package the right way: drivers, connection pools, prepared statements, transactions, context cancellation, and avoiding the classic Rows.Close leak.
- 36 defer/panic Learn how Go's defer, panic, and recover work together, when to use each, and how to write resilient code without abusing exceptions.
- 37 embed Bundle static files, templates, and SQL migrations into your Go binary with the embed package. Learn the directive syntax, embed.FS usage, and where it shines versus a separate assets dir.
- 38 Go Errors Idiomatic error handling in Go: sentinel values, wrapping with %w, errors.Is and As, custom types, and the structural patterns that keep code readable.
- 39 Fiber vs Gin vs Echo Compare the three most popular Go web frameworks: Fiber, Gin, and Echo. Look at routing, middleware, performance, ergonomics, and which fits which kind of project.
- 40 Go Generics How Go's generics work in practice: type parameters, constraints, the constraints package, and where generics shine versus interfaces or code generation.