4 ms·
Does defer get called on panic? I thought panic cancels all further execution
by adamwk 4y ago
Does defer get called on panic? I thought panic cancels all further execution
- HALtheWise 4y agoYes it does, which is why recovering from a panic can be done in a deferred function. The go runtime maintains enough metadata to track what deferred functions need to be run while unwinding the stack.