Skip to content

Commit

Permalink
chore: use os.Stat in LogfileList
Browse files Browse the repository at this point in the history
Signed-off-by: D4ryl00 <[email protected]>
  • Loading branch information
D4ryl00 committed Oct 2, 2024
1 parent 2a02c21 commit 7c74091
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/logutil/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,17 @@ func LogfileList(logDir string) ([]*Logfile, error) {
errs = multierr.Append(errs, err)
}

// use os.Stat to get the file size (updated than fs.FileInfo.Size()
filepath := filepath.Join(logDir, info.Name())
fi, err := os.Stat(filepath)
if err != nil {
errs = multierr.Append(errs, err)
}

logfiles = append(logfiles, &Logfile{
Dir: logDir,
Name: info.Name(),
Size: info.Size(),
Size: fi.Size(),
Kind: sub[1],
Time: t,
Errs: errs,
Expand Down

0 comments on commit 7c74091

Please sign in to comment.