From 0b5d0eb92c5be2f0ddb2fa73990f31e5654e57fe Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Mon, 14 Sep 2026 15:16:55 +0200 Subject: krino: 0.0.5 — keyword cache, t and d in review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/scan/scan.go | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'internal/scan/scan.go') diff --git a/internal/scan/scan.go b/internal/scan/scan.go index 7fe9e92..77cca66 100644 --- a/internal/scan/scan.go +++ b/internal/scan/scan.go @@ -24,6 +24,26 @@ type File struct { Size int64 ModTime time.Time Mode fs.FileMode + + // Dev and Ino identify the file on its filesystem; both are 0 where the + // platform reports neither. + Dev, Ino uint64 +} + +// NewFile builds the File for path, at rel under the root, from its Lstat +// info. +func NewFile(path, rel string, info fs.FileInfo) File { + dev, ino := fileID(info) + return File{ + Path: path, + Rel: rel, + Name: filepath.Base(path), + Size: info.Size(), + ModTime: info.ModTime(), + Mode: info.Mode(), + Dev: dev, + Ino: ino, + } } // Reason is why an entry was not returned as a File. @@ -217,14 +237,7 @@ func (w *walker) walk(dir, relDir string, depth int, entries []os.DirEntry) erro w.result.Skipped = append(w.result.Skipped, Skipped{Rel: rel, Reason: TooBig}) continue } - w.result.Files = append(w.result.Files, File{ - Path: path, - Rel: rel, - Name: name, - Size: info.Size(), - ModTime: info.ModTime(), - Mode: info.Mode(), - }) + w.result.Files = append(w.result.Files, NewFile(path, rel, info)) } return nil } -- cgit v1.3