title: Array of struct in Go language
body: <p>I am new to Go and want to create and initialise an struct array in go. My code is like this</p>
  
  <pre><code>type node struct {
  name string
  children map[string]int
  }
  
  cities:= []node{node{}}
  for i := 0; i&lt;47 ;i++ {
      cities[i].name=strconv.Itoa(i)
      cities[i].children=make(map[string]int)
  }
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>panic: runtime error: index out of range
  
  goroutine 1 [running]:
  panic(0xa6800, 0xc42000a080)
  </code></pre>
  
  <p>Please help. TIA :)</p>