title: Go range over uint8 slice?
body: <p><em>EDIT This was due to a stupid error in my part, but the question is worth keeping around in case someone else does this.</em></p>
  
  <p>I would hope that this works:</p>
  
  <pre><code>var xs []uint8
  var x uint8
  for x = range xs {
  
  }
  </code></pre>
  
  <p>But I get the error:</p>
  
  <pre><code>cannot assign type int to x (type uint8) in range
  </code></pre>
  
  <p>i.e. (as I understand it) the <code>range</code>, even though it is operating on a slice of <code>uint8</code>, is trying to use <code>int</code> as the iterated value.</p>
  
  <p>I have looked through the language spec, the relevant bit:</p>
  
  <pre><code>Range expression                          1st value          2nd value (if 2nd variable is present)
  
  array or slice  a  [n]E, *[n]E, or []E    index    i  int    a[i]       E
  </code></pre>
  
  <p>so I would expect it to be <code>E</code> the 'parameterised type'*, in this case <code>uint8</code> not <code>int</code>.</p>
  
  <p>Have I grasped onto the wrong end of the stick? Is there a bit of documentation that I missed? Or can I really not iterate over a <code>uint8</code> slice with a <code>uint8</code> variable?</p>
  
  <p>*I know it's not really a generic parameterised type.</p>