3 ms·
That's one problem that named arguments solve pretty nicely. Unfortunately, I don't think Go supports them.
by TillE 12y ago
That's one problem that named arguments solve pretty nicely. Unfortunately, I don't think Go supports them.
- lobster_johnson 12y agoYou have anonymous strict literals, though, which are nearly as succinct and can serve the same role.
- MetaCosm 12y agoThere are a lot of ways to make arguments nicer in Go. The simple on is to just use a configuration struct (or anon struct) at that has nice names. But, for complex stuff, functional options as laid out by Dave Cheney: http://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis http://dave.cheney.net/2014/10/17/functional-options-for-fri... (video: https://www.youtube.com/watch?v=24lFtGHWxAQ https://www.youtube.com/watch?v=24lFtGHWxAQ)