Skip to content

Commit

Permalink
source/local: trim whitespace from input
Browse files Browse the repository at this point in the history
Trim leading and trailing whitespace from the input (from feature files
and hooks). Makes it a bit more relaxed on the expected input format.
  • Loading branch information
marquiz committed Aug 4, 2023
1 parent 45dc46a commit 181b4e0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions source/local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,10 @@ func (s *localSource) GetFeatures() *nfdv1alpha1.Features {
func parseFeatures(lines [][]byte) map[string]string {
features := make(map[string]string)

for _, line := range lines {
for _, l := range lines {
line := strings.TrimSpace(string(l))
if len(line) > 0 {
lineSplit := strings.SplitN(string(line), "=", 2)
lineSplit := strings.SplitN(line, "=", 2)

key := lineSplit[0]

Expand Down

0 comments on commit 181b4e0

Please sign in to comment.