Skip to content

Commit

Permalink
support both pointer and values
Browse files Browse the repository at this point in the history
  • Loading branch information
ozkatz committed Apr 13, 2024
1 parent 7bf8f82 commit 29e3699
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions file/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ type FileInfo struct {
// GetInfo extracts some non-standardized items from the result of a Stat call.
func GetInfo(fi os.FileInfo) *FileInfo {
sys := fi.Sys()
if v, ok := sys.(*FileInfo); ok {
switch v := sys.(type) {
case FileInfo:
return &v
case *FileInfo:
return v
default:
return getOSFileInfo(fi)
}
return getOSFileInfo(fi)
}

0 comments on commit 29e3699

Please sign in to comment.