The explicit type switch also lets you streamline handling of uint8, uint16, etc (just return value) and panic or error if given a type you don't expect.
But I find it unfortunate that type switches must have single type cases. For example, it's too bad this doesn't work:
But I find it unfortunate that type switches must have single type cases. For example, it's too bad this doesn't work:
http://play.golang.org/p/a4j1I6Oug-
The OP's complaint would be minor if the compiler would auto-unroll the multi-type case clause.