diff options
| author | Jeff Carr <[email protected]> | 2024-12-13 00:19:33 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-12-13 00:19:33 -0600 |
| commit | c5f7570834f092608cd2137e966399f44aa02d36 (patch) | |
| tree | d0aee40b2fffc1729b654c9cfbe65a4a0183d768 /shell.go | |
| parent | adddfad2b7418dcaec4bd6c97219b72774fe0cac (diff) | |
working on go-mod-clean
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'shell.go')
| -rw-r--r-- | shell.go | 25 |
1 files changed, 19 insertions, 6 deletions
@@ -1,9 +1,12 @@ package gitpb import ( + "errors" + "fmt" "os" "path/filepath" "strings" + "time" "github.com/go-cmd/cmd" "go.wit.com/lib/gui/shell" @@ -46,17 +49,17 @@ func (repo *Repo) RunRealtime(cmd []string) cmd.Status { } // for now, even check cmd.Exit -func (repo *Repo) strictRun(cmd []string) (bool, error) { +func (repo *Repo) StrictRun(cmd []string) error { result := repo.RunQuiet(cmd) if result.Error != nil { - log.Warn("go mod init failed err:", result.Error) - return false, result.Error + log.Warn(repo.GoPath, cmd, "wow. golang is cool. an os.Error:", result.Error) + return result.Error } if result.Exit != 0 { - log.Warn("go mod init exit =", result.Exit) - return false, result.Error + log.Warn(cmd, "failed with", result.Exit) + return errors.New(fmt.Sprint(cmd, "failed with", result.Exit)) } - return true, nil + return nil } func (repo *Repo) Exists(filename string) bool { @@ -85,3 +88,13 @@ func (repo *Repo) IsDirectory() bool { } return info.IsDir() } + +func (repo *Repo) mtime(filename string) (time.Time, error) { + pathf := filepath.Join(repo.FullPath, filename) + statf, err := os.Stat(pathf) + if err == nil { + return statf.ModTime(), nil + } + log.Log(GITPBWARN, "mtime() error", pathf, err) + return time.Now(), err +} |
