|
|
|
|
|
by abbot2
2440 days ago
|
|
I find it amusing that the advice in the style guide gives a good example contradicting another good example, and contains a subtle bug. In the "Reduce Scope of Variables", second good example leaks an open file when WriteString fails, because it doesn't follow the own advice of "Defer to Clean Up" if you are curious. (Handling that properly with a defer is a bit more tricky - something like https://play.golang.org/p/l1PeWM3Tisg). Update: style guide was fixed after this report :) It was this if you wonder: https://github.com/uber-go/guide/blob/a53ee0bef8c0b11b52340d... |
|