Yeah, I actually do like the Riak `WithCluster` stuff we currently have, and 
it's easy to forget to `defer foo.Close()` in all the different places in the 
API that it's required in. It would be nice in the `WithRows` function to also 
check `rows.Err()` to make sure there wasn't an error returned from 
`rows.Next()`, since that's something we're not currently doing and are letting 
those errors go unnoticed.

I do also like the `WithInfo` idea. It might not be _idiomatic Go_, but context 
managers (via the `with` keyword in Python) are _pythonic_ things to use, which 
might be why my inner python dev likes doing things this way. I think the added 
indentation of using `WithFoo` is worth the added safety of auto-closing stuff 
that could potentially bring the TO to its knees if left unclosed.

[ Full content available at: https://github.com/apache/trafficcontrol/pull/2862 
]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to