News for hackers. Stuff that matters.
Re:Go Developer Survey 2022 Q2 Results by teraflop on Thursday September 08, 2022 @01:32PM (#32768821)
Not really. It's idiomatic to use a single "err" variable for every error value in the same function body, and the compiler will only check whether that variable is used at least once; it doesn't perform a data flow analysis to ensure that every value that might be assigned is used.

So if you assign 10 different error results to the same variable at various points, but only actually check it 9 times and forget the 10th, the compiler will not tell you that anything's wrong.

Re:Go Developer Survey 2022 Q2 Results by bheadmaster on Thursday September 08, 2022 @01:37PM (#32768890)
You are right. I forgot about that case.

Perhaps variable re-declarations (via := operator) would be a good addition to Go. Compiler could optimize the code to re-use the variables when possible, but the semantics of the language would force the programmer to handle each and every error.