Skip to content

Commit 50a8e86

Browse files
authored
fix: prefix with upper case letters (#81)
Signed-off-by: Fernandez Ludovic <[email protected]>
1 parent 5446fc2 commit 50a8e86

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

pkg/section/parser.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ func Parse(data []string) (SectionList, error) {
2525
list = append(list, Standard{})
2626
} else if s == "newline" {
2727
list = append(list, NewLine{})
28-
} else if strings.HasPrefix(s, "prefix(") && len(s) > 8 {
29-
list = append(list, Custom{s[7 : len(s)-1]})
30-
} else if strings.HasPrefix(s, "commentline(") && len(s) > 13 {
31-
list = append(list, Custom{s[12 : len(s)-1]})
28+
} else if strings.HasPrefix(s, "prefix(") && len(d) > 8 {
29+
list = append(list, Custom{d[7 : len(d)-1]})
30+
} else if strings.HasPrefix(s, "commentline(") && len(d) > 13 {
31+
list = append(list, Custom{d[12 : len(d)-1]})
3232
} else {
3333
errString += fmt.Sprintf(" %s", s)
3434
}

pkg/section/parser_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@ func TestParse(t *testing.T) {
2525
expectedSection: SectionList{Custom{"go"}},
2626
expectedError: nil,
2727
},
28+
{
29+
input: []string{"prefix(go-UPPER-case)"},
30+
expectedSection: SectionList{Custom{"go-UPPER-case"}},
31+
expectedError: nil,
32+
},
33+
{
34+
input: []string{"PREFIX(go-UPPER-case)"},
35+
expectedSection: SectionList{Custom{"go-UPPER-case"}},
36+
expectedError: nil,
37+
},
2838
{
2939
input: []string{"prefix("},
3040
expectedSection: nil,

0 commit comments

Comments
 (0)