3 ms·
The second one is pretty intentional - it'd be annoying it were downright impossible. The first and third one fails on go vet. The first one also fails to comp
by jchw 6y ago
The second one is pretty intentional - it'd be annoying it were downright impossible.
The first and third one fails on go vet. The first one also fails to compile if you never read from err in the entire function.
- networkimprov 6y agoVet accepts the third, and may (I forget) accept the first if err is redeclared or simply assigned.
- jchw 6y agoMy bad, I was thinking of errcheck, which is more thorough and integrated into most Go linting tools like Go CI linter. https://github.com/kisielk/errcheck https://github.com/kisielk/errcheck In any case, it’s trivial to detect via static analysis.