fix 'file already closed' in Go 1.9

License: MIT
Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
This commit is contained in:
Łukasz Magiera 2017-08-20 23:23:55 +02:00
parent b6eb085067
commit 1a93abcd69

View File

@ -60,7 +60,14 @@ func (f *serialFile) NextFile() (File, error) {
// if a file was opened previously, close it
err := f.Close()
if err != nil {
return nil, err
switch err2 := err.(type) {
case *os.PathError:
if err2.Err != os.ErrClosed {
return nil, err
}
default:
return nil, err
}
}
// if there aren't any files left in the root directory, we're done