Re: [go-nuts] error handling thoughts

2023-07-27 Thread Ian Lance Taylor
On Thu, Jul 27, 2023 at 8:04 AM Steve Roth wrote: > > In those cases, what I'd like to write is > > if result, err := fn(); err != nil { > > // handle error and bail out > > } else { > > // act on result > } > > > Unfortunately, the compiler gives a warning on that. As others have pointe

[go-nuts] error handling thoughts

2023-07-27 Thread Steve Roth
The ongoing Go survey asked a question about satisfaction with error handling in Go. I'd like to express an opinion on it that I haven't seen elsewhere, for which there was not room in the survey. I am generally a fan of the explicit error handling code in Go, but I get frustrated by the interact