Go Defer Statement: What It Is And When To Use

The Go defer statement allows you to schedule a function to be called immediately before the surrounding function returns. If you are familiar with Python, you probably know about Python’s with statement. The goal of this construct is never to forget freeing or closing resources. The Go defer statement was added to Go for precisely … Read more