You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the go/constant semantic change you need to call ToInt first:
package main
import (
"go/constant"
"go/token"
)
func main() {
million := constant.MakeFromLiteral("1e6", token.FLOAT, 0)
million = constant.ToInt(million)
x, ok := constant.Int64Val(million) // panic: 1000000 (constant.ratVal) not an Int
println(x, ok)
}
This program panics when built and run with a tip Go distribution:
http://play.golang.org/p/AOMz-2Sduz
It works under Go 1.5.
The text was updated successfully, but these errors were encountered: