diff options
Diffstat (limited to 'findNext.go')
| -rw-r--r-- | findNext.go | 118 |
1 files changed, 22 insertions, 96 deletions
diff --git a/findNext.go b/findNext.go index 16c213f..b9f1fe8 100644 --- a/findNext.go +++ b/findNext.go @@ -2,14 +2,10 @@ package main import ( - "errors" "fmt" - "os" - "path/filepath" "go.wit.com/log" - "go.wit.com/lib/gui/shell" "go.wit.com/lib/protobuf/gitpb" ) @@ -17,58 +13,6 @@ var findCounter int var findFix bool = false var findOk bool = true -func checkpkgcache(repo *gitpb.Repo) error { - homedir, err := os.UserHomeDir() - if err != nil { - return err - } - rver := repo.GetLastTag() - if rver == "" { - return errors.New("could not get master version") - } - moddir := filepath.Join(homedir, "go/pkg/mod", repo.GetGoPath()+"@"+rver) - if shell.IsDir(moddir) { - return nil - } - - getpath := repo.GetGoPath() + "@" + repo.GetLastTag() - _, err = me.startRepo.RunVerbose([]string{"go", "get", getpath}) - return err -} - -func rillRestore(repo *gitpb.Repo) error { - if me.forge.Config.IsReadOnly(repo.GetGoPath()) { - return nil - } - if me.forge.Config.IsPrivate(repo.GetGoPath()) { - return nil - } - if err := checkpkgcache(repo); err != nil { - return err - } - _, err := repo.RunVerboseOnError([]string{"go-mod-clean", "--restore"}) - if err != nil { - return err - } - log.Info("go-mod-clean restore worked ", repo.GetGoPath()) - return nil -} - -func slowRestore() error { - all := me.forge.Repos.All() - for all.Scan() { - repo := all.Next() - if err := rillRestore(repo); err != nil { - badExit(err) - } - if repo.ParseGoSum() { - log.Info("go-mod-clean and parse worked", repo.GetGoPath()) - return nil - } - } - return nil -} - func checkDeps(repo *gitpb.Repo) error { if repo.GoDeps == nil { return fmt.Errorf("%s has GoDeps == nil", repo.GetGoPath()) @@ -121,8 +65,15 @@ func findNext() bool { log.Info("CAN NOT RELEASE DIRTY REPO", check.GetGoPath()) continue } + if alreadyDone(check) { + log.Info("findNext() ALREADY DONE. WHY IS THIS STILL CHECKING?", check.GetGoPath()) + log.Info("findNext() ALREADY DONE. WHY IS THIS STILL CHECKING?", check.GetGoPath()) + log.Info("findNext() ALREADY DONE. WHY IS THIS STILL CHECKING?", check.GetGoPath()) + continue + } log.Info("CHECKING:", check.GetGoPath()) - _, err := check.RunVerboseOnError([]string{"go-mod-clean", "--strict"}) + // _, err := check.RunVerboseOnError([]string{"go-mod-clean", "--strict"}) + _, err := check.RunStrictNew([]string{"go-mod-clean", "--strict"}) if err != nil { log.Info("FAILED:", check.GetGoPath()) continue @@ -141,7 +92,7 @@ func findNext() bool { log.Info("ParseGoSum() failed", check.GetGoPath()) continue } - if me.forge.FinalGoDepsCheckOk(check, false) { + if err := me.forge.FinalGoDepsCheckOk(check, argv.Verbose); err == nil { log.Info("GOOD TO GO ON", check.GetGoPath()) setCurrentRepo(check, "should be good to release", "pretty sure") return true @@ -163,50 +114,25 @@ func findNext() bool { return false } -func runGoClean(check *gitpb.Repo, myarg string) bool { - // check if the package dependancies changed, if so, re-publish - check.GoDeps = nil - - cmd := []string{"go-mod-clean", myarg} - // log.Info("Running", cmd, "in", check.GetGoPath()) - result := check.Run(cmd) - if result.Error != nil { - /* - log.Info(cmd, "failed with", result.Error, check.GetGoPath()) - log.Info("STDOUT") - log.Info(strings.Join(result.Stdout, "\n")) - log.Info("STDERR") - log.Info(strings.Join(result.Stderr, "\n")) - */ - return false - } - if result.Exit != 0 { - /* - log.Info(cmd, "failed with", result.Exit, check.GetGoPath()) - log.Info("STDOUT") - log.Info(strings.Join(result.Stdout, "\n")) - log.Info("STDERR") - log.Info(strings.Join(result.Stderr, "\n")) - */ - return false - } - if check.ParseGoSum() { - return true - } - log.Info("ParseGoSum() failed", check.GetGoPath()) - return false -} - // tries to fix the go.mod and go.sum files func fixGodeps(check *gitpb.Repo) bool { log.Info("fixGoDeps() START", check.GetGoPath()) log.Info("fixGoDeps() START", check.GetGoPath()) log.Info("fixGoDeps() START", check.GetGoPath()) var good bool = true - if !runGoClean(check, "--strict") { - log.Info("fixGoDeps() runGoClean() strict failed", check.GetGoPath()) - log.Info("fixGoDeps() runGoClean() strict failed", check.GetGoPath()) - log.Info("fixGoDeps() runGoClean() strict failed", check.GetGoPath()) + + check.GoDeps = nil + + if _, err := check.RunVerboseOnError([]string{"go-mod-clean", "--strict"}); err != nil { + log.Info("fixGoDeps() runGoClean() strict failed", check.GetGoPath(), err) + log.Info("fixGoDeps() runGoClean() strict failed", check.GetGoPath(), err) + log.Info("fixGoDeps() runGoClean() strict failed", check.GetGoPath(), err) + return false + } + if check.ParseGoSum() { + return true + } else { + log.Info("ParseGoSum() failed", check.GetGoPath()) return false } // skip primative ones |
