From 86136ce6152d2125a53fa98adb6e6ed4db949190 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 25 Jan 2024 02:23:56 -0600 Subject: avoid a few nil's Signed-off-by: Jeff Carr --- unix.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'unix.go') diff --git a/unix.go b/unix.go index 8c12ed8..47dde92 100644 --- a/unix.go +++ b/unix.go @@ -222,9 +222,18 @@ func VerifyLocalGoRepo(gorepo string) bool { // Form the path to the home Git directory gitDir := filepath.Join(usr.HomeDir, "go/src/", gorepo, ".git") - log.Log(WARN, "VerifyLocalGoRepo() checking directory:", gitDir) - return IsDirectory(gitDir) + if IsDirectory(gitDir) { + return true + } + goDir := filepath.Join(usr.HomeDir, "go/src/", gorepo) + gomod := goDir + "/go.mod" + log.Log(WARN, "VerifyLocalGoRepo() checking for go.mod :", gomod) + _, err = os.Stat(gomod) + if os.IsNotExist(err) { + return false + } + return true } func readFileToString(filename string) (string, error) { -- cgit v1.2.3