Module 15 Β· Design Patterns in Go β Lesson 1 of 8 Β· ~8 min
Functional Options
The most Go pattern there is
You've built the PawWalk server. Now the interview module: the design patterns a Go reviewer actually looks for. We lead with the one that has no equivalent in the Gang-of-Four book because it's pure Go β Functional Options.
The problem: your Server has a dozen knobs β port, timeout, TLS, logger. A constructor New(port, timeout, tls, logger, ...) is a wall of positional arguments where nobody remembers the order, and every new knob breaks every caller. Go has no default arguments and no named parameters to fall back on.