In your example you have a slice where each item it contains is an interface{}
rather than say, a single interface{}
representing a []float32
, for this reason you can't convert the whole collection so simply like that. Instead you have to iterate it and do a type assertion on each item in the collection. Here's an example; https://play.golang.org/p/dD4161xgaV
bound := []interface{}{1.00, 1.00, 1.00, 1.00}
new_bound := []float64{}
for _, v := range bound {
new_bound = append(new_bound, v.(float64))
}
One other thing to note, those literals have their type implied and it's float64
so you actually need that here.
EDIT: Including this more optimized solution posted by OneOfOne;
func main() {
bound := []interface{}{1.00, 1.10, 1.11, 1.111}
new_bound := make([]float64, len(bound))
for i := range bound {
new_bound[i] = bound[i].(float64)
}
fmt.Println(new_bound)
}