Skip to content

Commit

Permalink
Avoid unnecessary conversions
Browse files Browse the repository at this point in the history
  • Loading branch information
muesli committed Jun 8, 2021
1 parent 3c5ed6f commit 979dd99
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func ConfigValue(v interface{}, dst interface{}) error {
*d = int64(vt)
case string:
x, _ := strconv.ParseInt(vt, 0, 64)
*d = int64(x)
*d = x
default:
return fmt.Errorf("unhandled type %+v for uint8 conversion", reflect.TypeOf(vt))
}
Expand All @@ -120,7 +120,7 @@ func ConfigValue(v interface{}, dst interface{}) error {
*d = vt
case string:
x, _ := strconv.ParseFloat(vt, 64)
*d = float64(x)
*d = x
default:
return fmt.Errorf("unhandled type %+v for float64 conversion", reflect.TypeOf(vt))
}
Expand Down

0 comments on commit 979dd99

Please sign in to comment.