The Go standard library's
errors package makes it quick and easy to create error variables. Once the error variables are created, you can then use the if-statement pattern to decide what to do with it.
This article is part of the Error Handling in Go series.
The error’s package is a popular alternative to using Go’s built-in
error type. That’s because using…