cast.ToUint32("0134444") = 47396
cast.ToUint32("0134444") = 47396
my go version go1.23.4 darwin/amd64, cast version 1.71
Most programming languages of the C-family including Go treat integer numbers as octal if starting with 0 and hex if starting with 0x. Here it is starting with 0 hence considered as octal but decimal and resulted into different number than your expectation.
The reason this is happening is due to the 0 as the 2nd argument being used in the following lines:
https://github.com/spf13/cast/blob/01004f2c354f73d3cb4651ad7360ad03fb588e79/caste.go#L615-L620
If used as:
v, err := strconv.ParseUint(trimZeroDecimal("0134444"), 10, 0)
if v == nil {
fmt.Println(v)
}
This returns Uint(134444). https://goplay.tools/snippet/4iuNrPt2jDb
I've submitted a PR to address this so you can use this package and get unblocked.
See https://pkg.go.dev/strconv#ParseInt