|
|
|
|
|
by cocok
690 days ago
|
|
Can anyone familiar with Go explain why not return sayThanks(thanksStr)
I've seen this "if err != nil" pattern before, but I can't help thinking that it's not necessary."return ret, nil" ignores err's value, which is nil anyway. "return nil, err" ignores ret's value, but why? If the caller checks for err before doing anything with ret, it doesn't hurt having ret always passed up. 4 extra lines only to lose the value of ret in case of error. |
|