The implementation principle of defer in golang
The implementation principle of defer in golang, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.
Principle of golang defer implementation
Defer is a keyword provided by golang and is called before the execution of a function or method completes and returns.
Each time the defer pushes the defer function into the stack, and when the calling function or method ends, the execution is taken out of the stack, so the execution order of multiple defer is first in and then out.
For I: = 0; I