Catalog
All Go patterns
Sorted the way engineers reach for them: by the problem in front of you, not by the chapter they came from.
31 of 31
Abstract Factory Create related objects through one factory so whole product families can change together without leaking concrete types. unread Builder Separate a multi-step construction workflow from the final representation so the same input can produce different outputs cleanly. unread Factory Method Use constructor functions and small interfaces to select concrete implementations without coupling callers to them. unread Prototype Clone preconfigured object graphs when copying is simpler or faster than rebuilding the same structure from scratch. unread Singleton Use sync.Once carefully for one-time initialization, and understand when dependency injection is a better fit. unread Adapter Wrap an incompatible API behind the interface your application already expects so the rest of the code stays unchanged. unread Bridge Separate an abstraction from its implementation so both sides can vary independently without multiplying concrete types. unread Composite Treat individual objects and object groups uniformly so recursive tree structures stay simple to traverse and aggregate. unread Decorator Add behavior around an object dynamically by wrapping it with small focused layers that share the same interface. unread Facade Provide one simplified entry point over several collaborating subsystems so callers can trigger a workflow without knowing every step. unread Flyweight Share intrinsic immutable state across many small objects so large collections stay cheaper in memory and easier to manage. unread Proxy Control access to another object by standing in front of it to add caching, authorization, rate limiting, or lazy loading. unread Chain of Responsibility Build validation and request-processing pipelines with small handlers composed through interfaces. unread Command Encapsulate operations for queuing, audit history, and undo/redo while keeping Go error handling explicit. unread Interpreter Define a small grammar for recurring business rules and evaluate sentences of that grammar with an expression tree. unread Iterator Traverse a collection without exposing its internal representation, keeping traversal state separate from the aggregate. unread Mediator Centralize communication between collaborating objects so they depend on a coordinator instead of referencing each other directly. unread Memento Capture and restore object state without exposing internal details so undo and rollback remain explicit and controlled. unread Observer Notify dependent subscribers when state changes so event-driven reactions stay decoupled from the publisher. unread State Change an object’s behavior when its internal state changes by delegating transitions and rules to state-specific types. unread Strategy Encapsulate interchangeable algorithms behind one interface so callers can swap behavior without branching on concrete rules. unread Template Method Define the skeleton of an algorithm once while letting concrete steps vary through narrow hook methods. unread Visitor Add operations across a stable object structure without changing each node type whenever a new operation is introduced. unread Agent Loop (ReAct) Drive an agent by alternating reasoning and acting steps inside a structured loop that terminates when the model signals a final answer. unread Tool Use Register typed tools by name so an agent can dispatch LLM-selected function calls to the right handler without embedding dispatch logic in the agent itself. unread Orchestrator-Subagent Decompose a complex task by having a root agent spawn and coordinate specialized subagents, each responsible for one concern, then aggregate their results. unread Memory Give an agent a pluggable memory store — short-term context buffer, episodic session history, and optional long-term semantic store — through one interface so the storage backend can be swapped. unread Retrieval-Augmented Generation Ground LLM responses in authoritative documents by retrieving relevant chunks before generation so the model can cite real data instead of hallucinating. unread Human-in-the-Loop Pause agent execution at defined checkpoints to request human approval or input, then resume with the human's decision injected back into the agent's context. unread Prompt Template Build prompts from versioned, parameterized templates so prompt logic stays separate from agent orchestration code and can be tested, diffed, and swapped independently. unread Multi-Agent Communication Enable agents to exchange typed messages through a shared message bus so they can collaborate without direct references to each other's implementations. unread
No patterns match this filter.