Skip to content

Commit 7bf8f82

Browse files
committed
test if FileInfo.Sys() returns a *file.FileInfo and use that
1 parent 0e20378 commit 7bf8f82

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

file/file.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,11 @@ type FileInfo struct {
1111
Fileid uint64
1212
}
1313

14-
// FileInfoGetter allows os.FileInfo implementations that implement
15-
// the GetFileInfo() method to explicitly return a *FileInfo.
16-
// Useful for explicitly setting a Fileid without having to use the syscall package
17-
type FileInfoGetter interface {
18-
GetFileInfo() *FileInfo
19-
}
20-
2114
// GetInfo extracts some non-standardized items from the result of a Stat call.
2215
func GetInfo(fi os.FileInfo) *FileInfo {
23-
if v, ok := fi.(FileInfoGetter); ok {
24-
return v.GetFileInfo()
16+
sys := fi.Sys()
17+
if v, ok := sys.(*FileInfo); ok {
18+
return v
2519
}
2620
return getOSFileInfo(fi)
2721
}

0 commit comments

Comments
 (0)