Skip to content
Snippets Groups Projects
Verified Commit c46d5f4d authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

fix: wrong string conversion

parent a6716eda
Branches
Tags
No related merge requests found
...@@ -89,7 +89,7 @@ func SetValue[D any](obj D, keyWithDots string, newValue any) error { ...@@ -89,7 +89,7 @@ func SetValue[D any](obj D, keyWithDots string, newValue any) error {
if newValueKind == reflect.Int { if newValueKind == reflect.Int {
v.SetInt(int64(newValue.(int))) v.SetInt(int64(newValue.(int)))
} else { } else {
s, err := strconv.ParseInt(newValue.(string), 10, 64) s, err := strconv.ParseInt(fmt.Sprintf("%v", newValue), 10, 64)
if err != nil { if err != nil {
return err return err
} }
...@@ -101,7 +101,7 @@ func SetValue[D any](obj D, keyWithDots string, newValue any) error { ...@@ -101,7 +101,7 @@ func SetValue[D any](obj D, keyWithDots string, newValue any) error {
if newValueKind == reflect.Int { if newValueKind == reflect.Int {
v.SetUint(uint64(newValue.(int))) v.SetUint(uint64(newValue.(int)))
} else { } else {
s, err := strconv.ParseInt(newValue.(string), 10, 64) s, err := strconv.ParseInt(fmt.Sprintf("%v", newValue), 10, 64)
if err != nil { if err != nil {
return err return err
} }
...@@ -113,7 +113,7 @@ func SetValue[D any](obj D, keyWithDots string, newValue any) error { ...@@ -113,7 +113,7 @@ func SetValue[D any](obj D, keyWithDots string, newValue any) error {
if newValueKind == reflect.Bool { if newValueKind == reflect.Bool {
v.SetBool(newValue.(bool)) v.SetBool(newValue.(bool))
} else { } else {
b, err := strconv.ParseBool(newValue.(string)) b, err := strconv.ParseBool(fmt.Sprintf("%v", newValue))
if err != nil { if err != nil {
return err return err
} }
...@@ -126,7 +126,7 @@ func SetValue[D any](obj D, keyWithDots string, newValue any) error { ...@@ -126,7 +126,7 @@ func SetValue[D any](obj D, keyWithDots string, newValue any) error {
if newValueKind == reflect.Float64 { if newValueKind == reflect.Float64 {
v.SetFloat(newValue.(float64)) v.SetFloat(newValue.(float64))
} else { } else {
s, err := strconv.ParseFloat(newValue.(string), 64) s, err := strconv.ParseFloat(fmt.Sprintf("%v", newValue), 64)
if err != nil { if err != nil {
return err return err
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment