I'm trying to create a function that returns the all the key, value
of a map
as a slice
of slice
of tuples (where each tuple is {key, value}
)
Here's the code:
func ReturnTuples(map_ map[interface{}]interface{}) [][]interface{} {
toReturn := []([]interface{})
...
But I'm getting error for the toReturn
line:
type [][]interface {} is not an expression
How should I declare a slice of slice of interfaces? I see this as the only way. I tried without parenthesis like:
[][]interface{}
but it won't work either.
I tried to search for 'golang slice of slice' on google but very few things appear. For example I've only found how to create a simple one made of uint8
, which is: [][]uint8
.