News for hackers. Stuff that matters.
Re:Ent. An Entity Framework for Go by jjjeii3 on Wednesday February 03, 2021 @10:24AM (#26014411)
Why doesn't GO have a try-catch blocks? Every file I see have dozens similar lines:

if err != nil { log.Fatal(err) }

In C# I can just log error on one place and transaction will be automatically rolled back. Much less code.

Re:Ent. An Entity Framework for Go by ibraheemdev on Wednesday February 03, 2021 @11:31AM (#26015307)
There have been tons of discussions and proposals regarding error handling boilerplate [0][1], and the general consensus is that go developers like the explicitness of `if err != nil` and just want to leave it be [2]

[0]: https://github.com/golang/go/issues/32437 [1]: https://github.com/golang/go/issues/32804 [2]: https://github.com/golang/go/issues/32825

Re:Ent. An Entity Framework for Go by proyb on Wednesday February 03, 2021 @10:56AM (#26014776)
There are years of discussion on error handling topics or you could use a package to simplify your code: https://itnext.io/golang-error-handling-best-practice-a36f47...
Re:Ent. An Entity Framework for Go by sketchyj on Wednesday February 03, 2021 @10:45AM (#26014656)
Go made the design decision to encourage checking for errors where they occur instead of catching exceptions somewhere down the line.