Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mountinfo: move s.Err() out of scanner loop
The previous code would actually ignore IO errors during scanning, becuase s.Scan() returns false if there was an error (leaving the loop and never being detected). Indeed the correct way[1] of using the builtin bufio.Scanner is actually more like: s := bufio.NewScanner(...) for s.Scan() { // use s.Text() } if err := s.Err(); err != nil { return err } [1]: https://blog.golang.org/errors-are-values Signed-off-by: Aleksa Sarai <[email protected]>
- Loading branch information