Thank you for the response. I guess my example wasn't a very good one. We have situations like a <select> in the UI that controls which field to sort customers by, so we knew all the values were valid, and didn't have to do null-checking or error-handling.
I guess I wouldn't know if other statically typed languages have better solutions. Go, Haskell, and C are the only statically typed languages I know (and mostly Go).
I get it, there really are some situations — especially in web development — where typing can become painful (looking at you, JSON).
When writing Go one has essentially two options: mourn the relatively primitive type system and try to find clever workarounds or embrace Go for what it is and write the explicit slightly longer version. The correct answer is almost always the latter, as it's pretty much what the language designers expect you to do.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.