Re:Alan Donovan and Brian Kernighan Answer Questions on Go
by pcwalton on Friday November 20, 2015 @02:25PM
(#10603256)
If you call a function that returns nothing but an error, Go does not force you to acknowledge the error's existence and will silently allow you to drop it.
Re:Alan Donovan and Brian Kernighan Answer Questions on Go
by Karunamon on Friday November 20, 2015 @11:24AM
(#10602006)
Or not checking for the exception at all. Certain classes of errors can and should be allowed to pass up the call stack and cause your program to die (something strange that I wasn't expecting and don't know how to handle happened, and now I'm in a bad state - safer to exit)
In Go, as in Java with checked exceptions, the compiler forces the programmer to handle the error.
Using _ in Go is not idiomatic. It's the exact equivalent of using a try/catch block with nothing in the catch block in Java.