title: Check whether a string slice contains a certain value in Go
body: <p>What is the best way to check whether a certain value is in a string slice? I would use a Set in other languages, but Go doesn't have one.</p>
  
  <p>My best try is this so far:</p>
  
  <pre><code>package main
  
  import "fmt"
  
  func main() {
      list := []string{"a", "b", "x"}
      fmt.Println(isValueInList("b", list))
      fmt.Println(isValueInList("z", list))
  }
  
  func isValueInList(value string, list []string) bool {
      for _, v := range list {
          if v == value {
              return true
          }
      }
      return false
  }
  </code></pre>
  
  <p><a href="http://play.golang.org/p/gkwMz5j09n" rel="noreferrer">http://play.golang.org/p/gkwMz5j09n</a></p>
  
  <p>This solution should be ok for small slices, but what to do for slices with many elements?</p>