All Go Patterns

Published Go pattern articles organized by category. The focus is on idiomatic Go, not one-to-one class diagram translations.

Category
Complexity

30 patterns

Creational

5 published

Patterns for object creation in Go, usually expressed through constructor functions, interfaces, and functional options.

Structural

7 published

Patterns for composing types and boundaries in Go with interfaces, embedding, adapters, and focused packages.

Behavioral

10 published

Patterns for organizing control flow, workflows, and collaboration with explicit errors, interfaces, and small units of behavior.

Behavioral
Interactive

Chain of Responsibility in Go

Build validation and request-processing pipelines with small handlers composed through interfaces.

just now
Behavioral
Interactive

Command Pattern in Go

Encapsulate operations for queuing, audit history, and undo/redo while keeping Go error handling explicit.

just now
Behavioral
Interactive

Iterator in Go

Traverse a collection without exposing its internal representation, keeping traversal state separate from the aggregate.

just now
Behavioral
Interactive

Mediator in Go

Centralize communication between collaborating objects so they depend on a coordinator instead of referencing each other directly.

just now
Behavioral
Interactive

Memento in Go

Capture and restore object state without exposing internal details so undo and rollback remain explicit and controlled.

just now
Behavioral
Interactive

Observer in Go

Notify dependent subscribers when state changes so event-driven reactions stay decoupled from the publisher.

just now
Behavioral
Interactive

State in Go

Change an object’s behavior when its internal state changes by delegating transitions and rules to state-specific types.

just now
Behavioral
Interactive

Strategy in Go

Encapsulate interchangeable algorithms behind one interface so callers can swap behavior without branching on concrete rules.

just now
Behavioral
Interactive

Template Method in Go

Define the skeleton of an algorithm once while letting concrete steps vary through narrow hook methods.

just now
Behavioral
Interactive

Visitor in Go

Add operations across a stable object structure without changing each node type whenever a new operation is introduced.

just now

Agentic

8 published

Patterns for building AI agent systems in Go: reasoning loops, tool dispatch, memory, retrieval, and multi-agent coordination.

Agentic
Interactive

Agent Loop (ReAct) in Go

Drive an agent by alternating reasoning and acting steps inside a structured loop that terminates when the model signals a final answer.

just now
Agentic
Interactive

Tool Use in Go

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.

just now
Agentic
Interactive

Orchestrator-Subagent in Go

Decompose a complex task by having a root agent spawn and coordinate specialized subagents, each responsible for one concern, then aggregate their results.

just now
Agentic
Interactive

Memory in Go

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.

just now
Agentic
Interactive

Retrieval-Augmented Generation in Go

Ground LLM responses in authoritative documents by retrieving relevant chunks before generation so the model can cite real data instead of hallucinating.

just now
Agentic
Interactive

Human-in-the-Loop in Go

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.

just now
Agentic
Interactive

Prompt Template in Go

Build prompts from versioned, parameterized templates so prompt logic stays separate from agent orchestration code and can be tested, diffed, and swapped independently.

just now
Agentic
Interactive

Multi-Agent Communication in Go

Enable agents to exchange typed messages through a shared message bus so they can collaborate without direct references to each other's implementations.

just now