Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
Ijaz Ahmad
ksonnet
Commits
6e5cf904
Unverified
Commit
6e5cf904
authored
Apr 27, 2018
by
Bryan Liles
Committed by
GitHub
Apr 27, 2018
Browse files
Merge pull request #495 from bryanl/value-leading-zero
decode string with leading 0 as string
parents
dcebde9c
833a76df
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
2 deletions
+7
-2
pkg/util/jsonnet/object.go
pkg/util/jsonnet/object.go
+2
-2
pkg/util/jsonnet/object_test.go
pkg/util/jsonnet/object_test.go
+5
-0
No files found.
pkg/util/jsonnet/object.go
View file @
6e5cf904
...
@@ -248,8 +248,8 @@ func arrayValues(array *ast.Array) ([]interface{}, error) {
...
@@ -248,8 +248,8 @@ func arrayValues(array *ast.Array) ([]interface{}, error) {
}
}
var
(
var
(
reFloat
=
regexp
.
MustCompile
(
`^[-+]?
[0-9]*
\.
?
[0-9]+$`
)
reFloat
=
regexp
.
MustCompile
(
`^[-+]?
(0|[1-9]\d+)(
\.[0-9]+
)*
$`
)
reInt
=
regexp
.
MustCompile
(
`^([+-]?[1-9]\d*|0)$`
)
reInt
=
regexp
.
MustCompile
(
`^([+-]?[1-9]\d*|0
{1}
)$`
)
reArray
=
regexp
.
MustCompile
(
`^\[`
)
reArray
=
regexp
.
MustCompile
(
`^\[`
)
reMap
=
regexp
.
MustCompile
(
`^\{`
)
reMap
=
regexp
.
MustCompile
(
`^\{`
)
)
)
...
...
pkg/util/jsonnet/object_test.go
View file @
6e5cf904
...
@@ -241,6 +241,11 @@ func TestDecodeValue(t *testing.T) {
...
@@ -241,6 +241,11 @@ func TestDecodeValue(t *testing.T) {
val
:
"0"
,
val
:
"0"
,
expected
:
0
,
expected
:
0
,
},
},
{
name
:
"00"
,
val
:
"00"
,
expected
:
"00"
,
},
{
{
name
:
"bool true"
,
name
:
"bool true"
,
val
:
"True"
,
val
:
"True"
,
...
...
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