
The Go Workshop
By :

What is an error in Go? An error in Go is a value. Here is a quote from Rob Pike, one of the pioneers of Go:
"Values can be programmed, and since errors are values, errors can be programmed. Errors are not like exceptions. There's nothing special about them, whereas an unhandled exception can crash your program."
Since errors are values, they can be passed into a function, returned from a function, and evaluated just like any other value in Go.
An error in Go is anything that implements the error interface. We need to look at some fundamental aspects that make up the error type in Go. To be an error type in Go, it must first satisfy the type error interface
:
//https://golang.org/pkg/builtin/#error type error interface { Error()string }
The wonderful thing about Go is the simplistic design of the language features. This can easily be seen with the error interface. Go's standard library uses the error interface. To satisfy...