Original post

In Go, although errors are a controversial subject, they are in fact very simple. As programmers of Go we also spend a lot of our time writing if err != nil. But we often also need to create these errors and pass them back to other functions to handle.
The errors package allows to create errors, as per the error interface, which can be dealt with like any other error. In our example below we handle the error on main() and produce the error in DoSomething().