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