summaryrefslogtreecommitdiff
path: root/unix.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-13 00:43:26 -0600
committerJeff Carr <[email protected]>2024-01-13 00:43:26 -0600
commit86873b296cb856a1b8e7251047ccb2b04d188f9b (patch)
treec695bb84d63a00a3249c01e2bc65afd50d3832c3 /unix.go
parente2acf6511eb908cbc7813b8bda925c065e0b673a (diff)
work
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'unix.go')
-rw-r--r--unix.go39
1 files changed, 39 insertions, 0 deletions
diff --git a/unix.go b/unix.go
index 772e3b7..215a199 100644
--- a/unix.go
+++ b/unix.go
@@ -4,9 +4,11 @@ package repostatus
import (
"os"
"os/exec"
+ "os/user"
"strings"
"regexp"
"errors"
+ "path/filepath"
"go.wit.com/log"
)
@@ -147,3 +149,40 @@ func runCmd(path string, parts []string) (error, bool, string) {
// Print the output
return nil, true, tmp
}
+
+// Set the path to the package
+// Replace this with the actual path to the github.com/coredns/coredns directory
+func getfiles(pathToPackage string) {
+ // List files in the directory
+ err := filepath.Walk(pathToPackage, nil) // compiles but crashes
+ if err == nil {
+ log.Warn("directory ok", pathToPackage)
+ } else {
+ log.Warn("directory wrong", pathToPackage)
+ }
+}
+
+func IsDirectory(path string) bool {
+ info, err := os.Stat(path)
+ if err != nil {
+ return false
+ }
+ return info.IsDir()
+}
+
+
+
+func VerifyLocalGoRepo(gorepo string) bool {
+ // Get current user
+ usr, err := user.Current()
+ if err != nil {
+ log.Error(err, "VerifyLocalGoRepo() thinks you should switch to Ultrix")
+ return false
+ }
+
+ // Form the path to the home Git directory
+ gitDir := filepath.Join(usr.HomeDir, "go/src/", gorepo, ".git")
+
+ log.Warn("go directory:", gitDir)
+ return IsDirectory(gitDir)
+}