I would like to get the keys of an arbitrary map variable. And I found this function, which replicates the PHP array_keys
behaviour: https://www.php2golang.com/method/function.array-keys.html. But the following code:
items := map[string]int{
"one": 1,
"two": 2,
"three": 3,
}
keys := ArrayKeys(items)
throws the next 'compile time' exception:
cannot use items (type map[string]int) as type map[interface {}]interface {} in argument to ArrayKeys
what am I doing wrong?
Here's an example: https://play.golang.org/p/0ImqjPJFFiE
ArrayKeys
function. – Himanshu