title: Convert rune to int?
body: <p>In the following code, I iterate over a <code>string</code> rune by rune, but I'll actually need an <code>int</code> to perform some checksum calculation. Do I really need to encode the <code>rune</code> into a <code>[]byte</code>, then convert it to a <code>string</code> and then use <code>Atoi</code> to get an <code>int</code> out of the <code>rune</code>? Is this the idiomatic way to do it?</p>
  
  <pre><code>// The string `s` only contains digits.
  var factor int
  for i, c := range s[:12] {
      if i % 2 == 0 {
          factor = 1
      } else {
          factor = 3
      }
      buf := make([]byte, 1)
      _ = utf8.EncodeRune(buf, c)
      value, _ := strconv.Atoi(string(buf))
      sum += value * factor
  }
  </code></pre>
  
  <p>On the playground: <a href="http://play.golang.org/p/noWDYjn5rJ">http://play.golang.org/p/noWDYjn5rJ</a></p>