From 1fda646fef4737e9b027462589d89f97045a00c0 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Tue, 30 Jan 2024 16:48:57 -0600 Subject: add a stat(file) shortcut Signed-off-by: Jeff Carr --- unix.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/unix.go b/unix.go index 2bc03c4..d4498e1 100644 --- a/unix.go +++ b/unix.go @@ -212,6 +212,15 @@ func IsDirectory(path string) bool { return info.IsDir() } +// returns true if the file exists +func Exists(file string) bool { + _, err := os.Stat(file) + if err != nil { + return false + } + return true +} + func VerifyLocalGoRepo(gorepo string) bool { // Get current user usr, err := user.Current() -- cgit v1.2.3