summaryrefslogtreecommitdiff
path: root/unix.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-30 16:48:57 -0600
committerJeff Carr <[email protected]>2024-01-30 16:48:57 -0600
commit1fda646fef4737e9b027462589d89f97045a00c0 (patch)
tree4b52587f45f7f3d0ba5cd22f2d469562f6812e5c /unix.go
parent78049e664d7955df52d64aca3adc74b7539d1fa6 (diff)
add a stat(file) shortcut
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'unix.go')
-rw-r--r--unix.go9
1 files changed, 9 insertions, 0 deletions
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()