From f03c385dcda350b4bea8ecd2156a82a7b5c2fd48 Mon Sep 17 00:00:00 2001 From: Shreya Vidyadhar Date: Sat, 8 Aug 2026 23:46:25 +0530 Subject: [PATCH] libpod/events: use filepath.Dir for consistency in truncate() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The truncate() function in libpod/events/logfile.go used path.Dir on a filesystem path (filePath). The file is Linux/FreeBSD only per its build tag, so this isn't about Windows correctness — it's about internal consistency: the same file already calls filepath.Dir at line 32 for the same kind of path handling, and filepath is idiomatic for filesystem operations. Also removes the now-unused 'path' import. Fixes part of #25165 Signed-off-by: Shreya Vidyadhar --- libpod/events/logfile.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libpod/events/logfile.go b/libpod/events/logfile.go index 5cb58c722a..bf2c860803 100644 --- a/libpod/events/logfile.go +++ b/libpod/events/logfile.go @@ -9,7 +9,6 @@ import ( "fmt" "io" "os" - "path" "path/filepath" "time" @@ -287,7 +286,7 @@ func truncate(filePath string) error { size := origFinfo.Size() threshold := size / 2 - tmp, err := os.CreateTemp(path.Dir(filePath), "") + tmp, err := os.CreateTemp(filepath.Dir(filePath), "") if err != nil { // Retry in /tmp in case creating a tmp file in the same // directory has failed.