I have a function:
func ReturnTuples(map_ map[interface{}]interface{}) [][]interface{} {
In what I'm trying to call like this:
m := make(map[string]int)
m["k1"] = 7
m["k2"] = 13
fmt.Println(ReturnTuples(m))
But I get
cannot use m (type map[string]int) as type map[interface {}]interface {} in argument to ReturnTuples
Does not it work with string
and int
and realize interface{}
?
I searched, and the best I could find was Convert the interface map [interface {}] {} to match the string , but it won’t answer why I can’t use it m
as an argument.
I also believe that if there was only an argument to the function interface{}
, that would also work, since it map[something][something]
implements interface
, right? What is the best way to do this, and why won't this work in my case?
user6791424
source
share