News for hackers. Stuff that matters.
Re:Dysfunctional Options Pattern in Go by iambvk on Sunday July 21, 2024 @09:48AM (#41025074)
What are the downsides of just adding new methods on the `Config` structure?

    func (c *Config) WithFizz(...) {...}

    func (c *Config) WithBazz(...) {...}
Re:Dysfunctional Options Pattern in Go by rednafi on Sunday July 21, 2024 @10:09AM (#41025227)
Isn't it essentially doing exactly that? The only difference is that it returns a pointer to the struct from each method. The advantange of doing that is it allows you to compose it as such `WithFizz(...).WithBazz(...)`.

If you don't need the composition, you can just add the methods as above and call it a day.