summaryrefslogtreecommitdiff
path: root/unix.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-25 02:23:56 -0600
committerJeff Carr <[email protected]>2024-01-25 02:23:56 -0600
commit86136ce6152d2125a53fa98adb6e6ed4db949190 (patch)
tree25131c5dc1c0fa7f10ee9a30c894d1d185db9e6f /unix.go
parent4beeb0bb137bf179064354fa6fc3be2c951bdef6 (diff)
avoid a few nil'sv0.13.4
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'unix.go')
-rw-r--r--unix.go13
1 files changed, 11 insertions, 2 deletions
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) {