cast
cast copied to clipboard
cast.ToBool return wrong value for int
ToBoolE function can not recognize int64 nor int32, which result in false return I hope it will be fixed soon.
I believe I also ran into this issue, for example:
package main
import (
"fmt"
"github.com/spf13/cast"
)
func main() {
fmt.Printf("its %t\n", cast.ToBool(float64(1)))
}
prints its false
. I've worked around it by casting to an int before bool.