Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Ijaz Ahmad
ksonnet
Commits
0479f8ba
Unverified
Commit
0479f8ba
authored
May 11, 2018
by
Bryan Liles
Committed by
GitHub
May 11, 2018
Browse files
Merge pull request #526 from bryanl/param-set-semver
If param set float fails, use string
parents
958a6267
fd0bca08
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
pkg/util/jsonnet/object.go
pkg/util/jsonnet/object.go
+5
-1
pkg/util/jsonnet/object_test.go
pkg/util/jsonnet/object_test.go
+5
-0
No files found.
pkg/util/jsonnet/object.go
View file @
0479f8ba
...
...
@@ -265,7 +265,11 @@ func DecodeValue(s string) (interface{}, error) {
case
reInt
.
MatchString
(
s
)
:
return
strconv
.
Atoi
(
s
)
case
reFloat
.
MatchString
(
s
)
:
return
strconv
.
ParseFloat
(
s
,
64
)
fStr
,
err
:=
strconv
.
ParseFloat
(
s
,
64
)
if
err
!=
nil
{
return
s
,
nil
}
return
fStr
,
nil
case
strings
.
ToLower
(
s
)
==
"true"
||
strings
.
ToLower
(
s
)
==
"false"
:
return
strconv
.
ParseBool
(
s
)
case
reArray
.
MatchString
(
s
)
:
...
...
pkg/util/jsonnet/object_test.go
View file @
0479f8ba
...
...
@@ -295,6 +295,11 @@ func TestDecodeValue(t *testing.T) {
},
},
},
{
name
:
"semantic version"
,
val
:
"0.0.1"
,
expected
:
"0.0.1"
,
},
{
name
:
"string"
,
val
:
"foo"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment