Although maps and fragments in go themselves are generic, they are not covariant (and cannot be, since interfaces are not generics). This is part of working with a language that does not have generics; you will have to repeat some things.
If you really need to get the keys of any old card, you can use reflection for this:
func useKeys(m interface{}) { v := reflect.ValueOf(m) if v.Kind() != reflect.Map { fmt.Println("not a map!") return } keys := v.MapKeys() fmt.Println(keys) }
Jimb source share