if map key does not exist golang code example Example: go map check key exists if val, ok := dict["foo"]; ok { //do something here }