false negative, possibly due to an else statement
josharian opened this issue · comments
Josh Bleecher Snyder commented
This should be safe to transform:
if err := dump(w, n, rec); err != nil {
return err
} else {
fmt.Fprintln(w)
}
to:
try(dump(w, n, rec)
fmt.Fprintln(w)
(The key restriction is that err
does not appear in the else
block.
Robert Griesemer commented
Indeed. And if the assignment is using =
instead of :=
, it should be ok to transform even if err
appears in the else
block. Both these assume there are no aliases to err
.
codenoid commented
should we close
Robert Griesemer commented
@codenoid Yes. Thanks for reminding me.
Closing this issue as "wontfix" since we have abandoned the try
proposal.