From f7127d6ce13740092b4adbb01a1454f3f9d4624f Mon Sep 17 00:00:00 2001 From: Coder <161350311+MamunC0der@users.noreply.github.com> Date: Mon, 20 Oct 2025 15:30:04 +0200 Subject: [PATCH 1/3] Update path.go --- common/path.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/common/path.go b/common/path.go index 49c6a5efc2a4..4b46bdfd43e6 100644 --- a/common/path.go +++ b/common/path.go @@ -24,10 +24,7 @@ import ( // FileExist checks if a file exists at filePath. func FileExist(filePath string) bool { _, err := os.Stat(filePath) - if err != nil && os.IsNotExist(err) { - return false - } - return true + return !os.IsNotExist(err) } // AbsolutePath returns datadir + filename, or filename if it is absolute. From 03e8e4b2e24fa726472ec57cd5eee693ae4d9d9e Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Fri, 24 Oct 2025 17:23:32 +0200 Subject: [PATCH 2/3] Update FileExist to use errors.Is for checking existence --- common/path.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/path.go b/common/path.go index 4b46bdfd43e6..4f136d5fab8f 100644 --- a/common/path.go +++ b/common/path.go @@ -24,7 +24,7 @@ import ( // FileExist checks if a file exists at filePath. func FileExist(filePath string) bool { _, err := os.Stat(filePath) - return !os.IsNotExist(err) + return !errors.Is(err, fs.ErrNotExist) } // AbsolutePath returns datadir + filename, or filename if it is absolute. From b2e293df236f4ef7faa420fb0dec97c8d168e4ec Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Fri, 24 Oct 2025 17:24:17 +0200 Subject: [PATCH 3/3] Update path.go --- common/path.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/path.go b/common/path.go index 4f136d5fab8f..b2b07f56ef52 100644 --- a/common/path.go +++ b/common/path.go @@ -17,6 +17,8 @@ package common import ( + "errors" + "io/fs" "os" "path/filepath" )