mirror of
https://github.com/lionsoul2014/ip2region.git
synced 2025-12-08 19:25:22 +00:00
ignore empty lines
This commit is contained in:
parent
83e15427a8
commit
b3f775a196
@ -53,9 +53,11 @@ 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"))
|
||||||
|
if len(l) < 1 { // ignore empty line
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
// ignore the comment line
|
if l[0] == '#' { // ignore the comment line
|
||||||
if l[0] == '#' {
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user