how to check if a key exists in a map in golang code example Example: golang check if key is in map if val, ok := dict["foo"]; ok { //do something here }