title: Go - math.MaxInt64 and Type Inference Error
body: <p>I've been working on metaprogramming involving packages and I've been running into the error <code>constant 9223372036854775807 overflows int</code> whenever <code>math.MaxInt64</code> and <code>math.MaxUint64</code> show up.</p>
  
  <p>I've isolated it into two cases:</p>
  
  <p>Valid</p>
  
  <pre><code>var a int64 = math.MaxInt64
  b := interface{}(int64(math.MaxInt64))
  </code></pre>
  
  <p>Not Valid</p>
  
  <pre><code>a := math.MaxInt64
  b := interface{}(math.MaxInt64)
  </code></pre>
  
  <p><a href="https://play.golang.org/p/U1QDmFbV29" rel="nofollow">https://play.golang.org/p/U1QDmFbV29</a></p>
  
  <p>It seems like that Go doesn't do correct type inference.</p>
  
  <p>Is this a bug or expected behavior? And if expect, does anyone know why?</p>