3 ms·
I usually create a struct once my parameter list goes past 3. Then, pass that in. Or, if applicable, create a method instead.
by H1Supreme 7y ago
I usually create a struct once my parameter list goes past 3. Then, pass that in. Or, if applicable, create a method instead.
- Insanity 7y agoIn production code I do this too. The struct approach has various advantages (nice syntax, maintainable, shows the meaning of what you are passing, ..). I like functional programming hence the blogpost, and I like that I can do this in Go. There are places where you might want to do this but I'm not going to advocate doing this _every chance you get_. But hey, Go lets me write how I want and that's pretty cool!