Trivial: simplify localfs.Directory
@@ -254,14 +254,12 @@ func Directory(path string) (fs.Directory, error) {
return nil, err
}
- switch e := e.(type) {
- case fs.Directory:
- return e, nil
+ if d, ok := e.(fs.Directory); ok {
+ return d, nil
+ }
- default:
return nil, errors.Errorf("not a directory: %v", path)
}
-}
func entryFromChildFileInfo(fi os.FileInfo, parentDir string) (fs.Entry, error) {
switch fi.Mode() & os.ModeType {
