title: How to find out element position in slice?
body: <p>How does one determine the position of an element present in slice?</p>
  
  <p>I need something like the following:</p>
  
  <pre><code>type intSlice []int
  
  func (slice intSlice) pos(value int) int {
      for p, v := range slice {
          if (v == value) {
              return p
          }
      }
      return -1
  }
  </code></pre>