Learn idiomatic Go patterns when building a new service or library.
Find the Go-native way to implement a design pattern you know from other languages.
Reference concurrency and synchronization patterns when writing multi-threaded Go code.
Study how experienced Go developers structure and compose objects in real projects.
Go Patterns is a reference collection of design patterns, recipes, and idioms written in the Go programming language. Design patterns are well-known, reusable solutions to recurring problems in software development, named blueprints that experienced developers apply rather than reinventing solutions from scratch. This repository documents those patterns specifically for Go, helping developers write code that is more predictable, maintainable, and consistent with how the Go community tends to approach problems. The collection is organized into several categories. Creational patterns cover ways to create objects, for example, Singleton (ensuring only one instance of something exists) and Builder (constructing complex objects step by step). Structural patterns address how objects are composed together, like Proxy (controlling access to another object) and Decorator (adding behavior without changing the original). Behavioral patterns handle communication between objects, such as Observer (notifying listeners when something changes) and Strategy (swapping out algorithms at runtime). There are also categories for synchronization patterns (safely sharing resources between concurrent operations), concurrency patterns (running multiple tasks at once using Go's built-in features), messaging patterns, stability patterns (handling failures gracefully), and Go-specific idioms like functional options. Each entry links to a dedicated markdown file with explanation and Go code examples. You would use this as a study reference when learning Go, or when you want to find the idiomatic Go way to solve a specific structural or concurrency challenge in a real project.
Generated 2026-05-18 · Model: sonnet-4-6 · Verify against the repo before relying on details.