Nit: fix use of bufio.Scanner.Err
The Err() method should be called after the Scan() loop, not inside it. Found by: git grep -A3 -F '.Scan()' Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
@@ -45,10 +45,6 @@ func parseInfoFile(r io.Reader) ([]Info, error) {
|
||||
out := []Info{}
|
||||
var err error
|
||||
for s.Scan() {
|
||||
if err = s.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
/*
|
||||
See http://man7.org/linux/man-pages/man5/proc.5.html
|
||||
|
||||
@@ -128,6 +124,10 @@ func parseInfoFile(r io.Reader) ([]Info, error) {
|
||||
|
||||
out = append(out, p)
|
||||
}
|
||||
if err = s.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return out, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user