mirror of https://github.com/spf13/afero.git
CacheOnReadFS: Use os.IsNotExist to correctly detect cache misses
This commit is contained in:
parent
655d0bd1f1
commit
838d6de32d
|
@ -64,15 +64,10 @@ func (u *CacheOnReadFs) cacheStatus(name string) (state cacheState, fi os.FileIn
|
||||||
return cacheHit, lfi, nil
|
return cacheHit, lfi, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err == syscall.ENOENT {
|
if err == syscall.ENOENT || os.IsNotExist(err) {
|
||||||
return cacheMiss, nil, nil
|
return cacheMiss, nil, nil
|
||||||
}
|
}
|
||||||
var ok bool
|
|
||||||
if err, ok = err.(*os.PathError); ok {
|
|
||||||
if err == os.ErrNotExist {
|
|
||||||
return cacheMiss, nil, nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return cacheMiss, nil, err
|
return cacheMiss, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue