Skip to content

Instantly share code, notes, and snippets.

@jswank
Created December 6, 2011 17:21
Show Gist options
  • Save jswank/1439033 to your computer and use it in GitHub Desktop.
Save jswank/1439033 to your computer and use it in GitHub Desktop.
Check for existence of key in map
package main
import "fmt"
func main() {
m := make(map[string]string)
if m["foo"] == "" {
fmt.Println("No such key in map");
}
fmt.Printf("%s", m)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment