You can easily check if a key exists in a go map by using the ok result: value, ok := myMap[key] Or in an one line check: if val, ok := myMap[key]; ok { // do something }
You can easily check if a key exists in a go map by using the ok result: value, ok := myMap[key] Or in an one line check: if val, ok := myMap[key]; ok { // do something }