On Wed, 2017-01-11 at 17:15 -0800, hui zhang wrote: > switch v := x.(type) { > case int,int8,int16,int32:
What type is v here? It can't be any of the four types you have listed in the case since are not assignable to each other without conversion, so it must be an interface{}. interface{} cannot be converted to float64 without an assertion to a numerical type first. > return float64(v) > default: -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.