cast
cast copied to clipboard
bug of toInt toInt32 toInt64
a := []string{"01", "02", "03", "04", "05", "06", "07", "08", "09"} for _, v := range a { fmt.Println(cast.ToInt64(v)) } // output 1 2 3 4 5 6 7 0 0 // bug 08 => 0 09 =>0
This is not a bug --- since these leading 0s is treated as octal, or base-8 number system.