Skip to content

Commit

Permalink
Fix strconv.ParseFloat usage (#1335)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
kolyshkin committed Feb 17, 2022
1 parent 3df9a3c commit 81cb783
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions flag_float64.go
Expand Up @@ -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)
}
Expand Down

0 comments on commit 81cb783

Please sign in to comment.