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:
Kir Kolyshkin
2020-03-11 19:36:21 -07:00
parent c6851ace61
commit 6e638ad27a
3 changed files with 7 additions and 10 deletions

View File

@@ -1238,11 +1238,11 @@ func WithEnvFile(path string) SpecOpts {
sc := bufio.NewScanner(f)
for sc.Scan() {
if sc.Err() != nil {
return sc.Err()
}
vars = append(vars, sc.Text())
}
if err = sc.Err(); err != nil {
return err
}
return WithEnv(vars)(nil, nil, nil, s)
}
}