Chore: Handle wrapped errors (#29223)

* Chore: Handle wrapped errors

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
This commit is contained in:
Arve Knudsen
2020-11-19 13:34:28 +01:00
committed by GitHub
co-authored by Emil Tullstedt
parent 0cb29d337a
commit 294770f411
34 changed files with 153 additions and 124 deletions
+1 -2
View File
@@ -134,12 +134,11 @@ func (w *FileLogWriter) lineCounter() (int, error) {
c, err := r.Read(buf)
count += bytes.Count(buf[:c], []byte{'\n'})
switch {
case err == io.EOF:
case errors.Is(err, io.EOF):
if err := r.Close(); err != nil {
return count, err
}
return count, nil
case err != nil:
return count, err
}