"type" is a magic word in Go, and in that example. It's highly idiomatic -- it's inconsistent with the rest of the language (Using "type" instead of an actual type), but it makes sense once you memorize the idiom. Sort of perlish -- there are two different operations that look basically the same, and the correct one is chosen based on context (in this case, the context is "is there a type name, or "type" literally?)
Perhaps it would have been cleaner to use "*" or some other operator symbol instead of the reserved word "type"
> "type" is a magic word in Go, and in that example.
Specifically, type switches are a specific syntax construct that look very similar to normal switches, but switched on something that looks like a type assertion with "type" in place of an actual type.
Perhaps it would have been cleaner to use "*" or some other operator symbol instead of the reserved word "type"