2 ms·
if you use the standard if _, err := foo(); err != nil { then the err variable's scope is limited to the if statement (usually correct), and you can then move
by NateDad 14y ago
if you use the standard if _, err := foo(); err != nil {
then the err variable's scope is limited to the if statement (usually correct), and you can then move that if statement where ever you want and it will stay intact, and will not interfere with the external code.