Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
feloy committed Jun 13, 2022
1 parent 73947ff commit 7201405
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions pkg/vars/vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ func parseKeyValueString(s string, lookupEnv func(string) (string, bool)) (strin
parts := strings.SplitN(line, "=", 2)
key := parts[0]

// TODO validate key format

if len(key) == 0 {
return "", "", NewErrBadKey(fmt.Sprintf("no key defined in line %q", s))
}

var value string
if len(parts) > 1 {
value = parts[1]
Expand All @@ -103,10 +109,5 @@ func parseKeyValueString(s string, lookupEnv func(string) (string, bool)) (strin
}
}

// TODO validate key format

if len(key) == 0 {
return "", "", NewErrBadKey(fmt.Sprintf("no key defined in line %q", s))
}
return key, value, nil
}

0 comments on commit 7201405

Please sign in to comment.