Skip to content

Commit b9efe39

Browse files
committed
fs: how the eff did Sub not have Stat
1 parent d6ef5f9 commit b9efe39

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

fs/sub.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,19 @@ func (f *SubdirFS) Sub(dir string) (FS, error) {
7878
return &SubdirFS{f.Fsys, full}, nil
7979
}
8080

81+
func (f *SubdirFS) Stat(name string) (FileInfo, error) {
82+
return f.StatContext(context.Background(), name)
83+
}
84+
85+
func (f *SubdirFS) StatContext(ctx context.Context, name string) (FileInfo, error) {
86+
full, err := f.fullName("stat", name)
87+
if err != nil {
88+
return nil, err
89+
}
90+
info, err := StatContext(ctx, f.Fsys, full)
91+
return info, f.fixErr(err)
92+
}
93+
8194
func (f *SubdirFS) Open(name string) (File, error) {
8295
return f.OpenContext(context.Background(), name)
8396
}

0 commit comments

Comments
 (0)