Access a Map. Map access returns value [, exists]

value, ok := myMap["a"]

Check if a value exists

if _, ok := myMap["a"]; ok {
  // Exists
}

Go Set

Golang does not have a Set, you can use a map.

s2 := make(map[string]bool)
// or as a literal to insert values at init
s1 := map[string]bool{}
Link to original