diff options
| author | Jeff Carr <[email protected]> | 2025-02-07 11:21:36 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-02-07 11:21:36 -0600 |
| commit | 4bbf8c76bc83cc6ed942be1f13a944e40a4924df (patch) | |
| tree | 90b95bf0a8d2dd7471e61175fe6734a9cd6e450f | |
| parent | 7265c0d6a1bdd62142ac6f75a6a348587260f8ec (diff) | |
still smarterv0.0.75v0.0.74v0.0.73v0.0.72v0.0.71v0.0.70v0.0.69v0.0.68v0.0.67v0.0.66v0.0.65v0.0.64v0.0.63v0.0.62v0.0.61v0.0.60v0.0.59v0.0.58v0.0.57v0.0.56v0.0.55v0.0.54v0.0.53v0.0.52v0.0.51v0.0.50v0.0.49v0.0.48v0.0.47v0.0.46v0.0.45v0.0.44v0.0.43v0.0.42
| -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 { |
