Skip to content

Commit de5168e

Browse files
committed
Return concrete *os.FS from Sub() and Subvolume()
1 parent e19a022 commit de5168e

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

os/fs.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func NewFS() *FS {
3232

3333
// SubVolume is like Sub, but only sets the volume name (i.e. for Windows).
3434
// Calling SubVolume again on the returned FS results in an error.
35-
func (fs *FS) SubVolume(volumeName string) (hackpadfs.FS, error) {
35+
func (fs *FS) SubVolume(volumeName string) (*FS, error) {
3636
if fs.root != "" {
3737
return nil, &hackpadfs.PathError{Op: "subvolume", Path: volumeName, Err: errors.New("subvolume not supported on a SubFS")}
3838
}
@@ -48,7 +48,7 @@ func (fs *FS) SubVolume(volumeName string) (hackpadfs.FS, error) {
4848
}
4949

5050
// Sub implements hackpadfs.SubFS
51-
func (fs *FS) Sub(dir string) (hackpadfs.FS, error) {
51+
func (fs *FS) Sub(dir string) (*FS, error) {
5252
if !hackpadfs.ValidPath(dir) {
5353
return nil, &hackpadfs.PathError{Op: "sub", Path: dir, Err: hackpadfs.ErrInvalid}
5454
}

os/fs_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func TestFSTest(t *testing.T) {
3131
if !assert.NoError(tb, err) {
3232
tb.FailNow()
3333
}
34-
fs = subvFS.(*FS)
34+
fs = subvFS
3535
dir = dir[len(volumeName)+1:]
3636
} else {
3737
dir = strings.TrimPrefix(dir, "/")
@@ -40,7 +40,7 @@ func TestFSTest(t *testing.T) {
4040
if !assert.NoError(tb, err) {
4141
tb.FailNow()
4242
}
43-
return subFS.(*FS)
43+
return subFS
4444
},
4545
}
4646
var skipFacets []fstest.Facets

0 commit comments

Comments
 (0)