It's being switched on the type of v (string or other, in this case), though in a more complex case you could easily have several different types. The assignment basically redefines v to be the matched type inside the case statement. You could easily just add a "sv := v.(string)" as the first statement of "case string", then use sv in place of v within that block, but this does read much cleaner.
I think it gets more interesting when using several, often complex (struct) types in the same switch statement.
I think it gets more interesting when using several, often complex (struct) types in the same switch statement.