3 ms·
> OK, but you're not in "Go"-specific problems any more, that's just concurrency issues. It’s absolutely a go-specific problem from defer being function scoped
by masklinn 1y ago
> OK, but you're not in "Go"-specific problems any more, that's just concurrency issues.
It’s absolutely a go-specific problem from defer being function scoped. Which could be ignored if Unlock was idempotent but it’s not.
- prerok 1y agoIt's tedious, I agree, but I found it easiest to just wrap it in an inline function defined and called there and then. This alleviates all these problems of unlocks within if bodies at the cost of an indent (and maybe slight performance penalty).