Aim for useful zero values so `var b Buffer` works without setup. Where configuration is complex, use functional options rather than long parameter lists. Keep exported surfaces small, document behaviour, and avoid returning interfaces from constructors.
← Go theorytheory 0/50 · 0%
Design · medium
32. Struct Design and API Style
Options, constructors and zero values.
Check your understanding
1. Functional options replace…
2. Good Go APIs prefer…