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