Go does not have built-in structural design patterns like Adapter, Decorator, or Facade; you implement them using interfaces and composition. Define an interface for the behavior you need, then create a struct that wraps the target type and implements that interface to adapt or decorate it.
type Logger interface {
Log(msg string)
}
type StdLogger struct{}
func (s *StdLogger) Log(msg string) { fmt.Println(msg) }
type DecoratedLogger struct {
Logger
prefix string
}
func (d *DecoratedLogger) Log(msg string) {
d.Logger.Log(d.prefix + ": " + msg)
}