Fix strconv.ParseFloat usage (#1335)

The bitSize argument of ParseFloat should either be 32 or 64, not 10.

Found by staticcheck linter.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
main
Kir Kolyshkin 2 years ago committed by GitHub
parent 3df9a3cd86
commit 81cb783759
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -67,8 +67,7 @@ func (f *Float64Flag) IsVisible() bool {
func (f *Float64Flag) Apply(set *flag.FlagSet) error {
if val, ok := flagFromEnvOrFile(f.EnvVars, f.FilePath); ok {
if val != "" {
valFloat, err := strconv.ParseFloat(val, 10)
valFloat, err := strconv.ParseFloat(val, 64)
if err != nil {
return fmt.Errorf("could not parse %q as float64 value for flag %s: %s", val, f.Name, err)
}

Loading…
Cancel
Save