File tree Expand file tree Collapse file tree 2 files changed +2
-1
lines changed
Expand file tree Collapse file tree 2 files changed +2
-1
lines changed Original file line number Diff line number Diff line change @@ -285,7 +285,7 @@ func ValidIdentifier(name string) error {
285285
286286 first := true
287287 for _ , c := range name {
288- if ! unicode .IsLetter (c ) && (first || (! unicode .IsDigit (c ) && ! strings .ContainsRune (validVariableRunes , c ))) {
288+ if ! unicode .IsLetter (c ) && c != '_' && (first || (! unicode .IsDigit (c ) && ! strings .ContainsRune (validVariableRunes , c ))) {
289289 return fmt .Errorf ("Invalid variable identifier %s" , name )
290290 }
291291 first = false
Original file line number Diff line number Diff line change @@ -104,6 +104,7 @@ func TestValidIdentifier(t *testing.T) {
104104 {"A1" , true },
105105 {"A+" , false },
106106 {"A-_b" , true },
107+ {"__X" , true },
107108 }
108109 for _ , tst := range tests {
109110 err := ValidIdentifier (tst .raw )
You can’t perform that action at this time.
0 commit comments