title: GoLang Array Index on Struct
body: <pre><code>package main
  
  import "fmt"
  
  type Bar struct {
      high float64
      low  float64
  }
  
  func main() {
      var bars = []Bar{}
      bars = []Bar{
          {1.0, 2.0},
          {1.1, 2.1},
          {1.2, 2.2},
          {1.3, 2.3},
          {1.4, 2.4},
          {1.5, 2.5},
      }
      fmt.Println(bars)
      testFunction(&amp;bars)
  }
  
  func testFunction(array *[]Bar) {
      for i := 0; i &lt; 3; i++ {
          fmt.Println(*array[i])
      }
  }
  </code></pre>
  
  <p><a href="https://play.golang.org/p/MZwaFALHfuy" rel="nofollow noreferrer">https://play.golang.org/p/MZwaFALHfuy</a></p>
  
  <p>Why can I not access the array row?</p>
  
  <p>invalid operation: array[i] (type *[]Bar does not support indexing)</p>