3 ms·
Does Go still run defers at function exit rather than scope exit? Changing that would be a big improvement, although I guess they’d have to use a different keyw
by iainmerrick 5y ago
Does Go still run defers at function exit rather than scope exit? Changing that would be a big improvement, although I guess they’d have to use a different keyword to avoid breaking compatibility.
- _ph_ 5y agoAt function exit. You can of course always create an anonymous function to emulate a block like: func() { defer something() ... }() This basically has the same behavior as having a block there, but with the defer being called at the exit of that functions body.