Error handling is important for even the most basic Go program. Errors in Go implement the Error interface and must be dealt with at every layer of the code. Go errors do not work like exceptions, and unhandled errors can cause enormous problems. You should strive to handle and consider errors whenever they occur.
This chapter also covers logging since it's common to log whenever an actual error occurs. We'll also investigate wrapping errors so that a given error has the appropriate amount of context for the calling function.