diff --git a/common/path.go b/common/path.go index da84b9cf0a..fff3d21273 100644 --- a/common/path.go +++ b/common/path.go @@ -17,7 +17,9 @@ package common import ( + "errors" "fmt" + "io/fs" "os" "path/filepath" "runtime" @@ -33,10 +35,7 @@ func MakeName(name, version string) string { // 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 !errors.Is(err, fs.ErrNotExist) } // AbsolutePath returns datadir + filename, or filename if it is absolute.