File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -385,7 +385,7 @@ func handleTrailingComma(lgs []*lineGroup) (trimTrailingComma func([]*lineGroup)
385385 }
386386 }
387387
388- if n := len (dataGroups ); n > 1 && allEndInComma (dataGroups [0 :n - 1 ]) && ! endInComma ( dataGroups [n - 1 ]) {
388+ if n := len (dataGroups ); n > 1 && allEndInComma (dataGroups [0 :n - 1 ]) && ! dataGroups [n - 1 ]. matchesSuffix ( commaLineEnd ) {
389389 if dataGroups [n - 1 ].matchesSuffix (commentLineEnd ) {
390390 dataGroups [n - 1 ].replaceSuffix (commentLineEnd , ", $2" )
391391 } else {
@@ -411,7 +411,7 @@ func handleTrailingComma(lgs []*lineGroup) (trimTrailingComma func([]*lineGroup)
411411
412412func allEndInComma (lgs []* lineGroup ) bool {
413413 for _ , lg := range lgs {
414- if ! endInComma ( lg ) {
414+ if ! lg . matchesSuffix ( commaLineEnd ) {
415415 return false
416416 }
417417 }
@@ -422,7 +422,3 @@ var (
422422 commaLineEnd = regexp .MustCompile ("(,)( *)((#|//).*)?$" )
423423 commentLineEnd = regexp .MustCompile ("( *)((#|//).*)$" )
424424)
425-
426- func endInComma (lg * lineGroup ) bool {
427- return lg .matchesSuffix (commaLineEnd )
428- }
You can’t perform that action at this time.
0 commit comments