Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Pathfinder
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Monitor
Service Desk
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OSS
Libraries
Go
Utilities
Pathfinder
Commits
c46d5f4d
Verified
Commit
c46d5f4d
authored
2 years ago
by
Volker Schukai
Browse files
Options
Downloads
Patches
Plain Diff
fix: wrong string conversion
parent
a6716eda
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
set.go
+4
-4
4 additions, 4 deletions
set.go
with
4 additions
and
4 deletions
set.go
+
4
−
4
View file @
c46d5f4d
...
...
@@ -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
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment