News for hackers. Stuff that matters.
Re:Error stack traces in Go with x/xerror by obviouslynotme on Monday August 23, 2021 @11:37PM (#28284820)
I hate it. All it does is add if err != nil { return nil, err } to every other line. I love Go, but I have never understood the obsession with generics over putting try into the language. This is the biggest pain in Go, by far.

The vast majority of errors only stop or rollback the current action. An incredibly small amount of code uses errors to detect stop conditions or to retry.

Re:Error stack traces in Go with x/xerror by simiones on Tuesday August 24, 2021 @06:38AM (#28287009)
To be fair, generics can allow you to get rid of some of this boilerplate, in principle. Though I would still love to get some built-in error handling.
Re:Error stack traces in Go with x/xerror by obviouslynotme on Tuesday August 24, 2021 @03:01PM (#28293345)
Then you just have Railroad Programming without the monadic binding operators and currying of the languages where that is the main mode of dealing with errors. That sounds awful.
Re:Error stack traces in Go with x/xerror by aniforprez on Tuesday August 24, 2021 @04:20AM (#28286274)
I know people on HN hate python to some extent because of performance issues but I love the error handling in python. Trying to learn go on the side this is the biggest thing by far that just halted all of that. No error handling? I was baffled. I hope they add this into the language. There's no way I'm wasting time writing `if err != nil` all over my code. try/catch blocks please