Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
1105 Внедрение механизмов обеспечения безопасности цепочки поставки программных проектов
Legacy
scanned-projects
helm
Commits
e269b894
Unverified
Commit
e269b894
authored
7 years ago
by
Michelle Noorali
Committed by
GitHub
7 years ago
Browse files
Options
Download
Plain Diff
Merge pull request #3912 from michelleN/process-null
fix(pkg/strvals): evaluate "null" values
parents
870827c1
1850aead
release-2.17
dev-v2
release-2.10
release-2.11
release-2.12
release-2.13
release-2.14
release-2.15
release-2.16
v2.17.0
v2.17.0-rc.1
v2.16.12
v2.16.11
v2.16.10
v2.16.9
v2.16.8
v2.16.7
v2.16.6
v2.16.5
v2.16.4
v2.16.3
v2.16.2
v2.16.1
v2.16.0
v2.16.0-rc.2
v2.16.0-rc.1
v2.15.2
v2.15.1
v2.15.0
v2.15.0-rc.2
v2.15.0-rc.1
v2.14.3
v2.14.2
v2.14.1
v2.14.0
v2.14.0-rc.2
v2.14.0-rc.1
v2.13.1
v2.13.1-rc.1
v2.13.0
v2.13.0-rc.2
v2.13.0-rc.1
v2.12.3
v2.12.2
v2.12.1
v2.12.0
v2.12.0-rc.2
v2.12.0-rc.1
v2.11.0
v2.11.0-rc.4
v2.11.0-rc.3
v2.11.0-rc.2
v2.11.0-rc.1
v2.10.0
v2.10.0-rc.3
v2.10.0-rc.2
v2.10.0-rc.1
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pkg/strvals/parser.go
+8
-0
pkg/strvals/parser.go
pkg/strvals/parser_test.go
+5
-0
pkg/strvals/parser_test.go
with
13 additions
and
0 deletions
+13
-0
pkg/strvals/parser.go
+
8
−
0
View file @
e269b894
...
...
@@ -82,6 +82,10 @@ func ParseIntoString(s string, dest map[string]interface{}) error {
// parser is a simple parser that takes a strvals line and parses it into a
// map representation.
//
// where sc is the source of the original data being parsed
// where data is the final parsed data from the parses with correct types
// where st is a boolean to figure out if we're forcing it to parse values as string
type
parser
struct
{
sc
*
bytes
.
Buffer
data
map
[
string
]
interface
{}
...
...
@@ -329,6 +333,10 @@ func typedVal(v []rune, st bool) interface{} {
return
false
}
if
strings
.
EqualFold
(
val
,
"null"
)
{
return
nil
}
// If this value does not start with zero, and not returnString, try parsing it to an int
if
!
st
&&
len
(
val
)
!=
0
&&
val
[
0
]
!=
'0'
{
if
iv
,
err
:=
strconv
.
ParseInt
(
val
,
10
,
64
);
err
==
nil
{
...
...
This diff is collapsed.
Click to expand it.
pkg/strvals/parser_test.go
+
5
−
0
View file @
e269b894
...
...
@@ -81,6 +81,11 @@ func TestParseSet(t *testing.T) {
expect
map
[
string
]
interface
{}
err
bool
}{
{
"name1=null,f=false,t=true"
,
map
[
string
]
interface
{}{
"name1"
:
nil
,
"f"
:
false
,
"t"
:
true
},
false
,
},
{
"name1=value1"
,
map
[
string
]
interface
{}{
"name1"
:
"value1"
},
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
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
Menu
Explore
Projects
Groups
Topics
Snippets