diff options
| author | Jeff Carr <[email protected]> | 2024-12-03 03:18:27 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-12-03 03:18:27 -0600 |
| commit | 96b72979a116cb14974645514920e43eeebd4e0e (patch) | |
| tree | 088cc43f9500de703dad809ccbb2a80c1ed92a7f /findNext.go | |
| parent | 0abb2f78612fb9a3a0d91be8cc292398d4699c0d (diff) | |
almost, maybe, fully automated. maybe. finally.v0.22.28
Diffstat (limited to 'findNext.go')
| -rw-r--r-- | findNext.go | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/findNext.go b/findNext.go index 072e60d..c347f3c 100644 --- a/findNext.go +++ b/findNext.go @@ -7,6 +7,7 @@ import ( "go.wit.com/log" "go.wit.com/lib/gui/repolist" + "go.wit.com/lib/protobuf/gitpb" ) var findCounter int @@ -50,22 +51,27 @@ func findNext() bool { log.Info("boo, you didn't git clone", repo.GoPath()) return false } + if ok, err := check.ParseGoSum(); !ok { + log.Info("ParseGoSum() failed (probably repo needs go mod tidy)", err) + log.Info("ParseGoSum() findFix =", findFix, "findCounter =", findCounter) + // return false + } if findFix { - fixGodeps(repo) + log.Info("findFix is true. running fixGoDeps()") + fixGodeps(check) } findCounter += 1 if me.forge.FinalGoDepsCheckOk(check) { setCurrentRepo(repo, "should be good to release", "pretty sure") return true } + log.Info("findNext() got to the end. repo", repo.GoPath(), "did not work. trying to find a new one now") } - if me.current == nil { - if findCounter == 0 { - log.Info("NOTHING TO UPDATE. findCounter =", findCounter) - } else { - findFix = true - log.Info("me.current is nil findCounter =", findCounter, "so set findFix =", findFix) - } + if findCounter == 0 { + log.Info("NOTHING TO UPDATE. findCounter =", findCounter) + } else { + findFix = true + log.Info("me.current is nil findCounter =", findCounter, "so set findFix =", findFix) } log.Info("tried to findNext() but not sure what to do next counter =", findCounter, "findFix =", findFix) me.release.status.SetText("ALL DONE?") @@ -123,20 +129,17 @@ func goodGodeps(repo *repolist.RepoRow) bool { } // tries to fix the go.mod and go.sum files -func fixGodeps(repo *repolist.RepoRow) bool { +func fixGodeps(check *gitpb.Repo) bool { var good bool = true // check if the package dependancies changed, if so, re-publish - check := me.forge.Repos.FindByGoPath(repo.GoPath()) - if check == nil { - log.Info("boo, you didn't git clone", repo.GoPath()) - os.Exit(-1) - } // skip primative ones if check.GetGoPrimitive() { + log.Info("fixGoDeps() skipping primitive", check.GoPath) return true } ok, err := check.RedoGoMod() if err != nil { + log.Info("fixGoDeps() RedoGoMod() error", err) return false } if !ok { @@ -159,15 +162,14 @@ func fixGodeps(repo *repolist.RepoRow) bool { } else { // log.Info("IsReadOnly = false", depRepo.GetGoPath()) } - found := me.repos.View.FindByPath(depRepo.GetGoPath()) + found := me.forge.Repos.FindByGoPath(depRepo.GetGoPath()) if found == nil { log.Info("not found:", depRepo.GetGoPath()) continue } - if depRepo.GetVersion() != found.Status.GetMasterVersion() { - log.Printf("%-48s %10s (from gitpb)", depRepo.GetGoPath(), depRepo.GetVersion()) - header := found.StandardReleaseHeader() - log.Info(header, "(from repolist)") + if depRepo.GetVersion() != found.GetMasterVersion() { + log.Printf("%-48s %10s (gitpb depRepo)", depRepo.GetGoPath(), depRepo.GetVersion()) + log.Printf("%-48s %10s (gitpb found)", found.GetGoPath(), found.GetMasterVersion()) cmd := []string{"go", "get", depRepo.GetGoPath() + "@latest"} check.Run(cmd) } @@ -177,7 +179,10 @@ func fixGodeps(repo *repolist.RepoRow) bool { cmd = []string{"go", "mod", "edit", "-go=1.20"} check.Run(cmd) check.GoDeps = nil - check.ParseGoSum() + if ok, err := check.ParseGoSum(); !ok { + log.Info("ParseGoSum() failed", err) + return false + } deps = check.GoDeps.SortByGoPath() for deps.Scan() { |
