Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

Commit 16413c9

Browse files
Refactor skipSpaces so it calls readSpaces discarding the count
Signed-off-by: Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
1 parent af59652 commit 16413c9

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

sql/parse/util.go

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -64,20 +64,8 @@ func expect(expected string) parseFunc {
6464
}
6565

6666
func skipSpaces(r *bufio.Reader) error {
67-
for {
68-
ru, _, err := r.ReadRune()
69-
if err == io.EOF {
70-
return nil
71-
}
72-
73-
if err != nil {
74-
return err
75-
}
76-
77-
if !unicode.IsSpace(ru) {
78-
return r.UnreadRune()
79-
}
80-
}
67+
var unusedCount int
68+
return readSpaces(r, &unusedCount)
8169
}
8270

8371
// readSpaces reads every contiguous space from the reader, populating

0 commit comments

Comments
 (0)