Skip to content

Commit fe8fbf7

Browse files
authored
Merge pull request #7 from bk2204/backend-error-handling
backend: improve error handling
2 parents 1c213ee + f559f4c commit fe8fbf7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

backend.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ func findAllBackends(mainLoose *fileStorer, mainPacked *pack.Storage, root strin
4141
}
4242
return nil, err
4343
}
44+
defer f.Close()
4445

4546
scanner := bufio.NewScanner(f)
4647
for scanner.Scan() {
@@ -51,6 +52,11 @@ func findAllBackends(mainLoose *fileStorer, mainPacked *pack.Storage, root strin
5152
}
5253
storage = append(storage, pack)
5354
}
55+
56+
if err := scanner.Err(); err != nil {
57+
return nil, err
58+
}
59+
5460
return storage, nil
5561
}
5662

0 commit comments

Comments
 (0)