From c46d5f4df65991d5301cc1b233ba378c40fb6a7c Mon Sep 17 00:00:00 2001
From: Volker Schukai <volker.schukai@schukai.com>
Date: Fri, 23 Dec 2022 10:44:57 +0100
Subject: [PATCH] fix: wrong string conversion

---
 set.go | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/set.go b/set.go
index f1ab15f..f5ca2f4 100644
--- a/set.go
+++ b/set.go
@@ -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
 			}
-- 
GitLab