var v interface{} = "123" switch t := v.(type) { case nil: fmt.Println("v is nil") case int: fmt.Println("v is int") //fallthrough is not permitted in a type switch default: fmt.Println(t) //123 fmt.Println(t == v) //true fmt.Println(reflect.TypeOf(t)) //string }