src.elv.sh@v0.21.0-dev.0.20240515223629-06979efb9a2a/pkg/cli/lscolors/stat_unix.go (about) 1 //go:build unix 2 3 package lscolors 4 5 import ( 6 "os" 7 "syscall" 8 ) 9 10 func isMultiHardlink(info os.FileInfo) bool { 11 // The nlink field from stat considers all the "." and ".." references to 12 // directories to be hard links, making all directories technically 13 // multi-hardlink (one link from parent, one "." from itself, and one ".." 14 // for every subdirectories). However, for the purpose of filename 15 // highlighting, only regular files should ever be considered 16 // multi-hardlink. 17 return !info.IsDir() && info.Sys().(*syscall.Stat_t).Nlink > 1 18 }