From 2104a501aad1f2f46d118623402205a24c122fff Mon Sep 17 00:00:00 2001 From: SeekingBlues <51911626+SeekingBlues@users.noreply.github.com> Date: Thu, 12 May 2022 12:25:50 -0400 Subject: [PATCH] Fix user name, group name and link count display (#829) These type assertions for `Stat_t` were changed from `syscall` to the incorrect `unix` ones in c5bd676. Fixes #800. --- os.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/os.go b/os.go index 9b6b0ea..3dd9b1f 100644 --- a/os.go +++ b/os.go @@ -11,6 +11,7 @@ import ( "path/filepath" "runtime" "strings" + "syscall" "golang.org/x/sys/unix" ) @@ -177,7 +178,7 @@ func isHidden(f os.FileInfo, path string, hiddenfiles []string) bool { } func userName(f os.FileInfo) string { - if stat, ok := f.Sys().(*unix.Stat_t); ok { + if stat, ok := f.Sys().(*syscall.Stat_t); ok { if u, err := user.LookupId(fmt.Sprint(stat.Uid)); err == nil { return fmt.Sprintf("%v ", u.Username) } @@ -186,7 +187,7 @@ func userName(f os.FileInfo) string { } func groupName(f os.FileInfo) string { - if stat, ok := f.Sys().(*unix.Stat_t); ok { + if stat, ok := f.Sys().(*syscall.Stat_t); ok { if g, err := user.LookupGroupId(fmt.Sprint(stat.Gid)); err == nil { return fmt.Sprintf("%v ", g.Name) } @@ -195,7 +196,7 @@ func groupName(f os.FileInfo) string { } func linkCount(f os.FileInfo) string { - if stat, ok := f.Sys().(*unix.Stat_t); ok { + if stat, ok := f.Sys().(*syscall.Stat_t); ok { return fmt.Sprintf("%v ", stat.Nlink) } return ""