Skip to content

Commit fce872b

Browse files
committed
Ignore comments and blank lines in db
1 parent 78a3fe6 commit fce872b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

data/db.go

+7
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,17 @@ func initDatabase(db *Database) error {
6262
}
6363

6464
elem := scanner.Text()
65+
if strings.HasPrefix(elem, "#") {
66+
continue
67+
}
68+
6569
fields := strings.Split(elem, " ")
6670
num := len(fields)
6771

6872
if num < 2 {
73+
if num == 0 {
74+
continue
75+
}
6976
return fmt.Errorf(ErrorDatabaseSyntax, i)
7077
}
7178

0 commit comments

Comments
 (0)