News for hackers. Stuff that matters.
Re:What could Go wrong with a mutex by iainmerrick on Wednesday November 03, 2021 @08:21AM (#29093616)
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.
Re:What could Go wrong with a mutex by _ph_ on Wednesday November 03, 2021 @10:27AM (#29095089)
At 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.