Skip to content

Commit be61b74

Browse files
committed
Journal: fix validVarName validation when var starts with _
the validVarName function tries to test for variables starting with an underscore but there's a missing set of parentheses. Fixes #284
1 parent 88bfeed commit be61b74

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

journal/journal.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ func validVarName(name string) bool {
144144

145145
valid := name[0] != '_'
146146
for _, c := range name {
147-
valid = valid && ('A' <= c && c <= 'Z') || ('0' <= c && c <= '9') || c == '_'
147+
valid = valid && (('A' <= c && c <= 'Z') || ('0' <= c && c <= '9') || c == '_')
148148
}
149149
return valid
150150
}

journal/journal_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ func TestValidaVarName(t *testing.T) {
3535
"test",
3636
false,
3737
},
38+
{
39+
"_TEST",
40+
false,
41+
},
3842
}
3943

4044
for _, tt := range testCases {

0 commit comments

Comments
 (0)