What is this?
This site applies classic Gang of Four (GoF) design patterns to Go in a way that fits the language. Go still benefits from creational, structural, and behavioral patterns, but the shape of those patterns changes when you favor composition, interfaces, plain constructors, explicit errors, and package-level boundaries over inheritance-heavy object models.
The examples use practical commerce and platform scenarios so the patterns stay concrete. Each published article is backed by actual Go source files, and the write-up calls out the Go-specific tradeoffs that matter in real codebases.
How the patterns are organized
The patterns are still organized into the classic three categories:
- Creational — Construction-focused patterns such as Singleton and Factory Method, adapted to Go with constructor functions, interfaces, and functional options.
- Structural — Composition-focused patterns such as Adapter, Facade, Decorator, and Proxy, usually expressed through small interfaces and package boundaries.
- Behavioral — Workflow and collaboration patterns such as Chain of Responsibility, Command, Strategy, and State, typically implemented with interfaces and explicit control flow.
What each pattern page includes
- The Problem — A concrete scenario where the pattern is needed.
- The Solution — How the pattern translates into Go.
- Structure — The moving parts and how they collaborate.
- Implementation — Full Go source code with syntax highlighting.
- Best Practices — Guidance on Go idioms, tradeoffs, and testability.
- When to Use / When NOT to Use — Practical guidance on applicability.
- Related Patterns — Cross-references to complementary or alternative patterns.
Technology
This site is built with Astro, styled with Tailwind CSS, and uses MDX for content pages. All published code examples are real Go files imported at build time with syntax highlighting.