Structural patterns
Patterns for composing types and boundaries in Go with interfaces, embedding, adapters, and focused packages.
Adapter
unreadWrap an incompatible API behind the interface your application already expects so the rest of the code stays unchanged.
Bridge
unreadSeparate an abstraction from its implementation so both sides can vary independently without multiplying concrete types.
Composite
unreadTreat individual objects and object groups uniformly so recursive tree structures stay simple to traverse and aggregate.
Decorator
unreadAdd behavior around an object dynamically by wrapping it with small focused layers that share the same interface.
Facade
unreadProvide one simplified entry point over several collaborating subsystems so callers can trigger a workflow without knowing every step.
Flyweight
unreadShare intrinsic immutable state across many small objects so large collections stay cheaper in memory and easier to manage.
Proxy
unreadControl access to another object by standing in front of it to add caching, authorization, rate limiting, or lazy loading.