Hi Sven,

> *What is the difference to if err != nil { goto <label> } ?*

Thanks you for asking.

If you run *go fmt*  on a file that contains the formatting you ask about 
the line will be expanded to the 3 lines, which brings us back to status 
quo:

*if *

*err != nil { goto <label> } *Of course *go fmt* could be modified, but 
allowing that formatting strikes me as even more *non*-Go idiomatic than 
added a *when* command.
That said, I am not personally advocating for a *when* command, I was just 
comparing *when err != nil goto <label>* with the OP and proposer's *when 
err handle <label>*. #fwiw -Mike P.S. I think there is a approach similar to 
that proposed that simplify error handling even more as it would not 
require any code where this proposal requires *when* — a proposal that 
could also kill another bird with the one stone — but as the tendency of 
online programming communities is to shoot down proposals that present new 
ideas before their benefits can be fully understood I have been trying to 
find a way to introduce the idea without it falling victim to that fate. 


On Saturday, July 1, 2023 at 8:42:14 AM UTC-4 Sven Anderson wrote:


Mike Schinkel <...> schrieb am Fr. 30. Juni 2023 um 07:04:

*when err!=nil goto <label> *


What is the difference to `if err != nil { goto <label> }` ?

Go is awesome, because it does _not_ more and more syntax, especially with 
subtle nuances that one has to remember.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/daa56174-b570-4d73-91b8-f6bfa5ec1693n%40googlegroups.com.

Reply via email to