3 ms·
This is possible in Go right now. Use "if thing, err := blah(); err != nil { ... }". This is common for things like map access. See an example here https://p
by seanpfeifer 9y ago
This is possible in Go right now. Use "if thing, err := blah(); err != nil { ... }".
This is common for things like map access. See an example here https://play.golang.org/p/P3k5tgFLd2 https://play.golang.org/p/P3k5tgFLd2
- dguaraglia 9y agoWait! Is this a go 1.9 thing? I've been using 1.83 all this time.
- zimpenfish 9y agoI don't think it's a 1.9 thing - I've got code from 2017-02 which uses it (the quickest example I could find in my repos)
- dguaraglia 9y agoWTF? You are absolutely right. I could've sworn I had issues with this before. 25% of my irritation with Go just evaporated (the other 75% is how hard it is to run Delve, but I'll figure that out.)