title: go slice not behaving as expected
body: <p>I was trying to get hands-on in slice and I observed that its not behaving as expected.</p>
  
  <p>I was trying to get the cartesian product of n arrays of diff size. The output is not correct.</p>
  
  <p>here is my code</p>
  
  <pre><code>
  func main() {
     sl1 := []int{1,2,3}
     sl2 := []int{4}
     sl3 := []int{5,6}
     sl4 := []int{8,9}
     sl := [][]int{sl1,sl2,sl3,sl4}
     res := cartesianMain(sl)
     fmt.Println(res)
  }
  
  func cartesianMain(a [][]int)  [][]int {
     res := [][]int{}
     for i:=0;i&lt;len(a[0]) ;i++{
         res = append(res,[]int{a[0][i]})
     }
     for i:= 1;i&lt;len(a) ;i++{
         res = cartesianProduct(res,a[i])
     }
     return res;
  }
  func cartesianProduct(a [][]int, b []int) [][]int {
     result := [][]int{}
     for _,v1 := range b {
         for _,v2 := range a {
             result = append(result, append(v2,v1))
         }
     }
  return result
  }
  </code></pre>
  
  <p>actual output:</p>
  
  <pre><code>[[1 4 5 9] [2 4 5 9] [3 4 5 9] [1 4 6 9] [2 4 6 9] [3 4 6 9] [1 4 5 9] [2 4 5 9] [3 4 5 9] [1 4 6 9] [2 4 6 9] [3 4 6 9]]
  </code></pre>
  
  <p>expected output:
  if you see the sl4's 1st element 8 is over written by 9.
  correct answer will be :</p>
  
  <pre><code>[[1 4 5 8] [2 4 5 8] [3 4 5 8] [1 4 6 8] [2 4 6 8] [3 4 6 8] [1 4 5 9] [2 4 5 9] [3 4 5 9] [1 4 6 9] [2 4 6 9] [3 4 6 9]]
  </code></pre>