The Error interface is a pretty small and simple interface:
type Error interface{
Error() string
}
This interface is elegant because it's simple to make anything to satisfy it. Unfortunately, this also creates confusion for packages that need to take certain actions depending on the error received.
There are a number of ways to create errors in Go, this recipe will explore the creation of basic errors, errors that have assigned values or types, and of a custom error using a struct.