Golang判断类型示例
package mainimport "fmt"type Student struct { Name string}func TestType(items ...interface{}) { for k, v := range items { switch v.(type) { case string: fmt.Printf("type is string, %d[%v]\n", k, v) case bool: fmt.Printf("type is bool, %d[%v]\n", k, v) case int: fmt.Printf("type is int, %d[%v]\n", k, v) case float32, float64: fmt.Printf("type is flo...阅读全文