I started learning Go recently. I want to be able to save a data type to a variable, and convert another variable to it. I know one way to save a data type is by using reflect.Type
.
i := 5
t := reflect.TypeOf(i)
var f float32 = 4.2
But how do I convert f
to the type saved in t
?