diff --git a/cmds/core/du/du.go b/cmds/core/du/du.go index 68ef1c623c..9dd3b00076 100644 --- a/cmds/core/du/du.go +++ b/cmds/core/du/du.go @@ -7,6 +7,7 @@ package main import ( + "errors" "fmt" "io" "io/fs" @@ -16,6 +17,8 @@ import ( "syscall" ) +var errNoStatInfo = errors.New("os.FileInfo has no stat_t info") + func run(stdout io.Writer, files ...string) error { if len(files) == 0 { files = append(files, ".") @@ -42,7 +45,7 @@ func du(file string) (int64, error) { st, ok := info.Sys().(*syscall.Stat_t) if !ok { - return fmt.Errorf("can not stat: %v", path) + return fmt.Errorf("%v: %w", path, errNoStatInfo) } blocks += st.Blocks