3 ms·
It could be something like data := io.ReadAll(zd) ?: return nil, fmt.Errorf(...) like in Kotlin. I think this likes to encourage overly-long lines though,
by kevmo314 3y ago
It could be something like
data := io.ReadAll(zd) ?: return nil, fmt.Errorf(...)
like in Kotlin. I think this likes to encourage overly-long lines though, I'm personally happy with Go's error handling today.
- grose 3y agoOh yeah, I’m not seriously suggesting !! as a new language feature, just recommending it as an alternative to the article’s (!fn() and ^fn()). The reason for “abusing” these pre-existing syntaxes is so that you can take advantage of the official parser and AST package. Makes it easier to play around with. If Go were to ever actually add this feature, they definitely should use a new keyword or symbol.