I want to have a function like Map.containsKey() in Go, since Go itself does not provide this kind of functionality, can I alternatively have a custom function like MapContainsKey(someMap map[K]V, key K) in Go?
I do not know how to realize it because as far as I know there is no generics in Go yet.
I know I can do
if val, ok := someMap[key]; ok{
// some code here
}
but I want to wrap it in a function.