The Go Workshop
by Delio D'Anna, Andrew Hayes, Sam Hennessy, Jeremy Leasor, Gobin Sougrakpam, Dániel Szabó, Philipp Mieden, David Parker, Gwenn Etourneau, Arpit Aggarwal, Eugene Wang
6. Errors
Overview
In this chapter, we will be looking at various code snippets from the Go standard packages to get an understanding of Go's idiomatic way of performing error handling. We will also look at how to create custom error types in Go and see examples in the standard library.
By the end of this chapter, you will be able to distinguish between the different types of errors and compare error handling and exception handling. You will also be able to create error values and use panic() to handle errors and recover after a panic.
Introduction
In the previous chapter, we learned about creating functions. We also discovered that functions can be passed as parameters and returned from a function. In this chapter, we will work with errors ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access