ignore the comment line which start with #

This commit is contained in:
lion 2022-12-07 10:29:19 +08:00
parent d686979718
commit 83e15427a8
1 changed files with 6 additions and 0 deletions

View File

@ -53,6 +53,12 @@ func IterateSegments(handle *os.File, before func(l string), cb func(seg *Segmen
scanner.Split(bufio.ScanLines) scanner.Split(bufio.ScanLines)
for scanner.Scan() { for scanner.Scan() {
var l = strings.TrimSpace(strings.TrimSuffix(scanner.Text(), "\n")) var l = strings.TrimSpace(strings.TrimSuffix(scanner.Text(), "\n"))
// ignore the comment line
if l[0] == '#' {
continue
}
if before != nil { if before != nil {
before(l) before(l)
} }