Don't Panic! Go has you covered
Posted on March 31, 2020
In this short blog post we are going to cover Panic in Go. Go has a fantastic functionality that lets you panic if you get an unexpected error and want you application to stop the execution.
A common use of panic is to abort if a function returns an error that we don’t know how to handle. Here’s an example of
panic if we get an unexpected error when creating a new file.
If you were to run this you would get a the following printed to your console
panic: an unexpected error has happened! I am Panicking and any goroutine traces are printed, and the application will exit with a non-zero status in this case a 2 status, you can try for yourself by using this link to the go playground.
I finished the first part of the nanodegree a few days ago and decided to give an indepth review of what is covered, what you learn and what is completed by the end of it.
When you first start thinking about becoming a developer, one of the things you might hear is you need to be a math(s) wizz. I am here to tell you that a small number of developers need the mathematics outside of algebra.