Golang's "defer" Explained (With Examples)
In this post, we will learn about the special defer keyword in Go. We will take an in-depth look into deferred statements and learn their uses, as well as some common pitfalls to look out for. If you just want to see the code, you can find the complete examples on Github Basic Usage The defer keyword instructs a function to execute after the surrounding function completes. Let’s look at a basic example:...