title: How do I use a (generic) vector in go?
body: <p>I am using a Vector type to store arrays of bytes (variable sizes)</p>
  
  <pre><code>store := vector.New(200);
  ...
  rbuf := make([]byte, size);
  ...
  store.Push(rbuf);
  </code></pre>
  
  <p>That all works well, but when I try to retrieve the values, the compiler tells me I need to use type assertions.  So I add those in, and try</p>
  
  <pre><code>for i := 0; i &lt; store.Len(); i++ {
     el := store.At(i).([]byte); 
  ...
  </code></pre>
  
  <p>But when I run this it bails out with:</p>
  
  <pre><code>interface is nil, not []uint8
  throw: interface conversion
  </code></pre>
  
  <p>Any idea how I can 'cast'/convert from the empty Element interface that Vector uses to store its data to the actual []byte array that I then want to use subsequently?</p>
  
  <hr>
  
  <p><strong>Update (Go1):</strong> The vector package has been removed on <a href="http://weekly.golang.org/doc/devel/weekly.html#2011-10-18" rel="nofollow noreferrer">2011-10-18</a>.</p>