title: Check if a slice contains a struct with a given field value
body: <p>Trying to check if a struct in some slice contains a value of a given field so i wrote this</p>
  
  <pre><code>   func main() {
      //test
      Objs := []Obj{{1,"xxx"},{2,"yyy"},{3,"zzz"}}
      res := containsStructFieldValue(Objs,"X",1)
      fmt.Println(res)
  }
  
  
  type Obj struct {
      X int
      Y string
  }
  
  func containsStructFieldValue(slice []Obj ,fieldName string,fieldValueToCheck interface {}) bool{
      for _,s := range slice{
          r := reflect.ValueOf(s)
          f := r.FieldByName(fieldName)
          if f.IsValid(){
              if f.Interface() == fieldValueToCheck{
                  return true //a field with the given value exists
              }
          }
      }
      return false
  }
  </code></pre>
  
  <p>i need it to work for any given struct type but when i tried <code>slice []interface</code> as the parameter i found out that its not possible, any idea on how to make the above method work for any struct type?</p>