Re:Go and Simplicity Debt Redux
by brandonbloom on Monday June 19, 2017 @12:06PM
(#14587970)
Yup! Type assertions work this way too. It's a much nicer design than traditional casts.
Check this out. With this tool, the type switch gets you exhaustiveness checks for hokey package-private sum-types in Go :)
By the way, Go already has this. If you have a variable, say `foo`, with a generic type, say `interface{}`, you can say
See https://golang.org/doc/effective_go.html#type_switch for details.