diff options
Diffstat (limited to 'unix.go')
| -rw-r--r-- | unix.go | 32 |
1 files changed, 7 insertions, 25 deletions
@@ -242,30 +242,6 @@ func Exists(file string) bool { return true } -func VerifyLocalGoRepo(gorepo string) bool { - // Get current user - usr, err := user.Current() - if err != nil { - log.Error(err, "VerifyLocalGoRepo() are you really POSIX compliant?") - return false - } - - // Form the path to the home Git directory - gitDir := filepath.Join(usr.HomeDir, "go/src/", gorepo, ".git") - log.Log(INFO, "VerifyLocalGoRepo() checking directory:", gitDir) - if IsDirectory(gitDir) { - return true - } - goDir := filepath.Join(usr.HomeDir, "go/src/", gorepo) - gomod := goDir + "/go.mod" - log.Log(INFO, "VerifyLocalGoRepo() checking for go.mod :", gomod) - _, err = os.Stat(gomod) - if os.IsNotExist(err) { - return false - } - return true -} - func readFileToString(filename string) (string, error) { data, err := ioutil.ReadFile(filename) if err != nil { @@ -280,7 +256,7 @@ func getGitDateStamp(gitdefault string) (time.Time, string, string) { const gitLayout = "Mon Jan 2 15:04:05 2006 -0700" tagTime, err := time.Parse(gitLayout, gitdefault) if err != nil { - log.Warn("GOT THIS IN PARSE AAA."+gitdefault+".AAA") + log.Warn("GOT THIS IN PARSE AAA." + gitdefault + ".AAA") log.Warn(err) return time.Now(), "Feb 1 12:34:56 1978 -0600", "" } @@ -321,8 +297,13 @@ func formatDuration(d time.Duration) string { minutes := int(d.Minutes()) % 60 hours := int(d.Hours()) % 24 days := int(d.Hours()) / 24 + years := int(d.Hours()) / (24 * 365) result := "" + if years > 0 { + result += fmt.Sprintf("%dy ", years) + return result + } if days > 0 { result += fmt.Sprintf("%dd ", days) return result @@ -350,6 +331,7 @@ func (rs *RepoStatus) Xterm(cmdline string) { func (rs *RepoStatus) XtermWait(cmdline string) { shell.XtermCmdWait(rs.Path(), []string{cmdline}) } + /* func (rs *RepoStatus) XtermNohup(args []string) { var argsX = []string{"xterm", "-geometry", "120x40"} |
