This is the current code for the checkClose function:
func checkClose(c io.Closer, err error) {
if c != nil {
cerr := c.Close()
if err == nil {
err = cerr
}
}
}
It looks like the intended effect is to replace err with cerr if err is nil and cerr is not. However, this replacement is only valid inside the scope of this function. To persist the change, we probably want to make err an error pointer.
Ha. 4ecf3c16aa1ebde1a25b2d4240595010598fd5d6 seems to change to what we have from exactly this. Still, I think this bit of code is an antipattern. Maybe we can inline in these places.
This is the current code for the
checkClose
function:It looks like the intended effect is to replace
err
withcerr
iferr
is nil andcerr
is not. However, this replacement is only valid inside the scope of this function. To persist the change, we probably want to makeerr
an error pointer.