5 ms·
1 and 2 are now possible to implement, since 1.18 - I'm using this and it does save quite a bit of boilerplate: github.com/life4/genesis I'd love to see less v
by herval 4y ago
1 and 2 are now possible to implement, since 1.18 - I'm using this and it does save quite a bit of boilerplate: github.com/life4/genesis
I'd love to see less verbose error handling too, but Rust's ? IMHO is not the best way to go - it adds quite a bit of magic and makes debugging difficult, when a question mark at the end of a line "injects" an unexpected return statement.
- leeoniya 4y agoalso https://github.com/samber/lo https://github.com/samber/lo
- svnpenn 4y ago2 has been possible since version 1.0 https://go.dev/doc/effective_go#maps https://go.dev/doc/effective_go#maps
- pjmlp 4y agoWhile it won't win the hearts of Gophers, I would use a utility function that panics if error, at least on throw away code.
- yakubin 4y agoThere are some instances of it in the stdlib, e.g. <https://pkg.go.dev/html/template@go1.18.4#Must https://pkg.go.dev/html/template@go1.18.4#Must> I'd guess with generics we can expect a generic "Must" to replace them.