Type assertion on a map doesn't work, is this the right way to do it?
Just to elaborate, my goal is to return a map with dynamic types. this example is just for demonstration.
package main
import "fmt"
func main() {
m := hello().(map[string]int)
fmt.Println(m)
}
func hello() interface{} {
return map[string]interface{} {
"foo": 2,
"bar": 3,
}
}
it panics
panic: interface conversion: interface {} is map[string]interface {}, not map[string]int