← Go in Practice
Full Examples
Complete examples for each lesson. Copy and run locally or in the linked playground.
01. Project Structure & Setup
- 📄 Project Setup · run locally
02. Configuration
- 📄 Config Struct · run locally
03. Structured Logging with slog
- 📄 slog Setup · Go Playground
- 📄 slogr Package · run locally
04. HTTP Routing with net/http
- 📄 Bookmarks API · run locally
05. Middleware
- 📄 Middleware Chain · run locally
06. Error Handling
- 📄 Trace Error · Go Playground
07. Multi-Module with go work
- 📄 Go Workspace · run locally
08. Database with database/sql
- 📄 Bookmark Store · run locally
09. HTTP Client
- 📄 URL Checker · run locally
10. Testing
- 📄 Handler Tests · run locally
11. Templates with html/template
- 📄 Bookmark List Page · run locally
12. Embedding with go:embed
- 📄 Embed Assets · run locally
13. Graceful Shutdown
- 📄 Graceful Main · run locally
14. Profiling & Benchmarks
- 📄 Benchmark · run locally
15. Makefile Docker & Deployment
- 📄 Docker Setup · run locally
16. Put It All Together
- 📄 Full main.go · run locally
- 📄 Full config.go · run locally
- 📄 Full model.go · run locally
- 📄 Full store.go · run locally
- 📄 Full handler.go · run locally
- 📄 Full handler_html.go · run locally
- 📄 Full middleware.go · run locally
- 📄 Full Templates · run locally
- 📄 Full Styles · run locally
- 📄 Full Docker Setup · run locally