title: Go Golang : Type assertion on customized type
body: <p><a href="http://play.golang.org/p/icQO_bAZNE" rel="nofollow">http://play.golang.org/p/icQO_bAZNE</a></p>
  
  <p>I am practicing sort using heap but </p>
  
  <pre><code>  prog.go:85: type bucket is not an expression
    prog.go:105: cannot use heap.Pop(bucket[i].([]IntArr)) (type interface {}) as type int in assignment: need type assertion
    [process exited with non-zero status]
  </code></pre>
  
  <p>I am getting those errors and can't figure out how to type assert properly</p>
  
  <p>The problem is from the lines:</p>
  
  <pre><code>  heap.Push(bucket[x].([]IntArr), elem)
  
    arr[index] = heap.Pop(bucket[i].([]IntArr))
  </code></pre>
  
  <p>Because I want to use heap structure in order to extract values from each bucket</p>
  
  <p>And each bucket is <code>[]IntArr</code></p>
  
  <p>And <code>IntArr</code> is <code>[]int</code> like the following</p>
  
  <pre><code>type IntArr []int
  type bucket [10]IntArr
  </code></pre>
  
  <p>I have been trying many ways over the weekend and can't figure out, I greatly appreciate it.</p>