aboutsummaryrefslogtreecommitdiff
path: root/pkg/u
diff options
context:
space:
mode:
authorGabriel A. Giovanini <mail@gabrielgio.me>2024-05-26 20:33:37 +0200
committerGabriel A. Giovanini <mail@gabrielgio.me>2024-05-26 20:33:37 +0200
commit4534dffb865eb1a50bfbc291a5c3798183081caf (patch)
treed5bd1a2d9912a6442e3be1511ffb1d99f12287b0 /pkg/u
parent349a3d1ff36a436261b1b65b870f8f262f06584f (diff)
downloadcerrado-4534dffb865eb1a50bfbc291a5c3798183081caf.tar.gz
cerrado-4534dffb865eb1a50bfbc291a5c3798183081caf.tar.bz2
cerrado-4534dffb865eb1a50bfbc291a5c3798183081caf.zip
feat: Add actual git listing implementation
Diffstat (limited to 'pkg/u')
-rw-r--r--pkg/u/file.go21
-rw-r--r--pkg/u/list.go (renamed from pkg/u/util.go)0
-rw-r--r--pkg/u/list_test.go (renamed from pkg/u/util_test.go)0
3 files changed, 21 insertions, 0 deletions
diff --git a/pkg/u/file.go b/pkg/u/file.go
new file mode 100644
index 0000000..cf86c75
--- /dev/null
+++ b/pkg/u/file.go
@@ -0,0 +1,21 @@
+package u
+
+import (
+ "errors"
+ "log/slog"
+ "os"
+)
+
+func FileExist(filename string) bool {
+ if _, err := os.Stat(filename); err == nil {
+ return true
+
+ } else if errors.Is(err, os.ErrNotExist) {
+ return false
+ } else {
+ slog.Warn("Schrödinger's file: it may or may not exist", "file", filename)
+ // Schrodinger: file may or may not exist. To be extra safe it will
+ // report the file doest not exist
+ return false
+ }
+}
diff --git a/pkg/u/util.go b/pkg/u/list.go
index 34eafd1..34eafd1 100644
--- a/pkg/u/util.go
+++ b/pkg/u/list.go
diff --git a/pkg/u/util_test.go b/pkg/u/list_test.go
index a6d84c7..a6d84c7 100644
--- a/pkg/u/util_test.go
+++ b/pkg/u/list_test.go