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
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...
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.