golang gets the string format of the variable type to enumerate the variable type

fmt.Println(reflect.TypeOf(var)) 

 

switch xxx.(type){

  case int:....

  case float32:...

  case float64:...

  case string:...

}

For the enumeration of type, fallthrough cannot be used, and float32 and float64 are two different types (there is no separate float type), while int contains int64

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325206637&siteId=291194637