Go programs express error state with
error type is a built-in interface similar to
error denotes success; a non-nil
error denotes failure.
Functions often return an
error value, and calling code should handle errors by testing whether the error equals
Go makes it possible to recover from a panic, by using the
recover built-in function. A
recover can stop a
panic from aborting the program and let it continue with execution instead.
Under the hood,
recover takes effect after
panic, so put it in