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