Defer

Defer

Going by literal meaning of the word Defer, means “put off an action or event to later time i.e. postponed”. In GO to the usage of keyword defer is to defer/postponed the execution. So next thing comes to our mind is till what time will the execution be deferred? And answer is to the end of method or function in which it is used. Let’s look at few examples to understand the usage of defer keyword.