Apr 5, 2022
--
This is very much an interpretation of Dave Cheney's functional options (https://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis), but I like the immutability part of it. In Dave's case, you'd rather work with a type, passing a pointer to it as part of the functional option.
Dylan Meeus Yours applies to package-level functions too, which I honestly happen to prefer more than attaching methods to random structs just for the sake of passing state around.