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.
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.