title: How to initialize and set a 2D array in golang
body: <p>I am trying to simplay make a 2D array as a field on an object. I want a function that creates the object and returns it. But when trying to create the 2d array it returns a single array.</p>
  <pre><code>type Struct struct {
      X int
      Y int
      Grid [][]bool
  }
  
  func NewLifeSimulator(sizeX, sizeY int) *Struct{
      s := &amp;Struct{
          X:    sizeX,
          Y:    sizeY,
          Grid: make([][]bool, sizeX,sizeY),  //Creates a regular array instead of 2D
      }
      return s
  }
  </code></pre>
  <p>What do I need to change so that my function initializes a 2D array?</p>