Val in Go
Val returns the underlying value for a given constant. Since it returns an interface, it is up to the caller to type assert the result to the expected type. The possible dynamic return types are:
package main
import (
"fmt"
"go/constant"
"math"
)
func main() {
maxint := constant.MakeInt64(math.MaxInt64)
fmt.Printf("%v\n", constant.Val(maxint))
e := constant.MakeFloat64(math.E)
fmt.Printf("%v\n", constant.Val(e))
b := constant.MakeBool(true)
fmt.Printf("%v\n", constant.Val(b))
b = constant.Make(false)
fmt.Printf("%v\n", constant.Val(b))
}