Skip to content

Commit d4206d3

Browse files
committed
use the fs package functions rather than methods
1 parent 20263c6 commit d4206d3

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

coderd/files/overlay.go

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import (
44
"io/fs"
55
"path"
66
"strings"
7-
8-
"golang.org/x/xerrors"
97
)
108

119
// overlayFS allows you to "join" together multiple fs.FS. Files in any specific
@@ -48,11 +46,7 @@ func (f overlayFS) ReadDir(p string) ([]fs.DirEntry, error) {
4846
break
4947
}
5048
}
51-
it, ok := target.(fs.ReadDirFS)
52-
if !ok {
53-
return nil, xerrors.New("provided fs.FS does not implement fs.ReadDirFS")
54-
}
55-
return it.ReadDir(p)
49+
return fs.ReadDir(target, p)
5650
}
5751

5852
func (f overlayFS) ReadFile(p string) ([]byte, error) {
@@ -63,9 +57,5 @@ func (f overlayFS) ReadFile(p string) ([]byte, error) {
6357
break
6458
}
6559
}
66-
it, ok := target.(fs.ReadFileFS)
67-
if !ok {
68-
return nil, xerrors.New("provided fs.FS does not implement fs.ReadFileFS")
69-
}
70-
return it.ReadFile(p)
60+
return fs.ReadFile(target, p)
7161
}

0 commit comments

Comments
 (0)