3 ms·
> Learn golang Having to "if err != nil" every single function call is a big put off - imagine having to "try catch" everything in a language like C#!
by thisismyswamp 3y ago
> Learn golang
Having to "if err != nil" every single function call is a big put off - imagine having to "try catch" everything in a language like C#!
- jen20 3y agoTwo functions solve this (in Go): func Must(err error) { if err != nil { panic(err) } } func Panic[T any](v T, err error) T { if err != nil { panic(err) } return v }
- AdamJacobMuller 3y agoI love it. It forces me to think about how my programs can fail and what I should do when they fail.
- thisismyswamp 3y agoBeing forced to think about every possible failure state is a sure way to spend a lot of time on not creating value for the end user