diff options
| -rw-r--r-- | cleanGoSum.go | 31 | ||||
| -rw-r--r-- | doSmart.go | 8 |
2 files changed, 25 insertions, 14 deletions
diff --git a/cleanGoSum.go b/cleanGoSum.go index 85abac7..8d416e2 100644 --- a/cleanGoSum.go +++ b/cleanGoSum.go @@ -8,6 +8,7 @@ import ( "sort" "strings" + "go.wit.com/lib/gui/shell" "go.wit.com/lib/protobuf/forgepb" "go.wit.com/lib/protobuf/gitpb" "go.wit.com/log" @@ -18,8 +19,8 @@ import ( // checks to see if every 'master' git branch version // matches the go.sum file func cleanGoDepsCheckOk(check *gitpb.Repo) error { - var err error = nil - var fixes [][]string + // var err error = nil + // var fixes [][]string log.Printf("current repo %s go dependancy count: %d", check.GetGoPath(), check.GoDepsLen()) if check.GoDeps == nil { return errors.New("check.GoDeps == nil") @@ -34,8 +35,7 @@ func cleanGoDepsCheckOk(check *gitpb.Repo) error { continue } log.Info("not found:", depRepo.GetGoPath()) - err = errors.New("not found: " + depRepo.GetGoPath()) - continue + return errors.New("not found: " + depRepo.GetGoPath()) } // log.Info("found dep", depRepo.GetGoPath()) if depRepo.GetVersion() != found.GetMasterVersion() { @@ -68,18 +68,23 @@ func cleanGoDepsCheckOk(check *gitpb.Repo) error { if ok, _ := forgepb.ValidGoVersion(found.GetMasterVersion()); ok { // can't go get invalid version numbers cmd := []string{"go", "get", depRepo.GetGoPath() + "@" + found.GetMasterVersion()} - fixes = append(fixes, cmd) + // fixes = append(fixes, cmd) + if _, err := shell.RunVerbose(cmd); err != nil { + return err + } + } else { + return errors.New(errs) } - err = errors.New(errs) } } } } - for i, cmd := range fixes { - log.Info("try cmd", i, cmd) - check.RunRealtime(cmd) - } - return err + /* + for i, cmd := range fixes { + log.Info("try cmd", i, cmd) + } + */ + return nil } func trimGoSum(check *gitpb.Repo) error { @@ -103,6 +108,10 @@ func trimGoSum(check *gitpb.Repo) error { } for _, line := range strings.Split(string(data), "\n") { + line = strings.TrimSpace(line) + if line == "" { + continue + } parts := strings.Fields(line) if len(parts) < 3 { log.Info("WIERD OR BAD:", line) @@ -38,9 +38,11 @@ func doSmart(repo *gitpb.Repo) error { return err } log.Info(repo.GetGoPath(), "the files were restored with redoGoMod()") - if repo.Exists("go.mod") { - return nil - } + /* + if repo.Exists("go.mod") { + return nil + } + */ // the first time, it'll attempt to fix some stuff if err := cleanGoDepsCheckOk(repo); err != nil { |
