summaryrefslogtreecommitdiff
path: root/findNext.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-30 16:14:41 -0500
committerJeff Carr <[email protected]>2025-10-30 16:14:41 -0500
commit78212e63806da6528b56a1c9f678d3ae59e8ebc2 (patch)
tree4db2fb223588e971b6cc230bfebfc4a47899cdc4 /findNext.go
parent7787400035d2e764caac766dc75111e1683e5537 (diff)
actually published a repo using this code
Diffstat (limited to 'findNext.go')
-rw-r--r--findNext.go86
1 files changed, 86 insertions, 0 deletions
diff --git a/findNext.go b/findNext.go
new file mode 100644
index 0000000..b1c23f9
--- /dev/null
+++ b/findNext.go
@@ -0,0 +1,86 @@
+package main
+
+import (
+ "fmt"
+ "os"
+
+ "go.wit.com/log"
+
+ "go.wit.com/lib/cobol"
+ "go.wit.com/lib/protobuf/gitpb"
+)
+
+// trys to figure out if there is still something to update
+// todo: redo this logic as it is terrible
+// rename this findNext()
+func findNext(found *gitpb.Repos) []*gitpb.Repo {
+ var trythese []*gitpb.Repo
+ // findCounter = 0
+ var simpletable [][]string
+ simpletable = append(simpletable, []string{"namespace", "function", "err reason"})
+ for check := range found.IterAll() {
+ if check.GetMasterBranchName() != check.GetCurrentBranchName() {
+ log.Info("FIND NEXT: YOU MUST BE ON THE MASTER BRANCH", check.GetNamespace())
+ continue
+ }
+ if check.IsDirty() {
+ // log.Info("FIND NEXT: CAN NOT RELEASE DIRTY REPO", check.GetNamespace())
+ simpletable = append(simpletable, []string{check.GetNamespace(), "CAN NOT RELEASE DIRTY REPO"})
+ continue
+ }
+ /*
+ if alreadyDone(check) {
+ log.Info("FIND NEXT: findNext() alreadyDone. WHY IS THIS STILL CHECKING?", check.GetNamespace())
+ continue
+ }
+ */
+ // log.Info("FIND NEXT: CHECKING START:", check.GetNamespace())
+
+ if me.forge.Config.IsPrivate(check.GetNamespace()) {
+ log.Info("FIND NEXT: GOOD TO GO ON PRIVATE REPO", check.GetNamespace())
+ trythese = append(trythese, check)
+ continue
+ }
+
+ godepsNew, err := check.GoSumFromRepo()
+ if err != nil {
+ errs := fmt.Sprintf("%v", err)
+ simpletable = append(simpletable, []string{check.GetNamespace(), "check.GoSumFromRepo()", errs})
+ continue
+
+ }
+ if godepsNew == nil {
+ // don't check godepsNew, but check to make sure go mod tidy actually ran without error
+ os.Unsetenv("GO111MODULE")
+ cmd := []string{"go", "mod", "tidy"}
+ err := check.RunVerbose(cmd)
+ if err != nil {
+ log.Info("FIND NEXT: go mod tidy failed. this go package needs to be examined by hand as it doesn't appear to be primitive")
+ log.Info("FIND NEXT:", check.FullPath, cmd)
+ os.Exit(-1)
+ }
+ // if godepsNew == nil, then this go package is a primitive and there is no go.sum file
+ } else {
+ if err := testGoDepsCheckOk(godepsNew); err != nil {
+ log.Info("FIND NEXT: CHECKING current repo deps failed", err)
+ continue
+ }
+ }
+
+ if err := finalGoDepsCheckOk(check); err != nil {
+ // if err := me.forge.FinalGoDepsCheckOk(check, false); err != nil {
+ // log.Info("FIND NEXT: FinalGoDepsCheckOk() repo=", check.GetNamespace(), "err:", err)
+ // log.Info("FIND NEXT: CHECKING END:", check.GetNamespace())
+ // log.Info("FIND NEXT: ")
+ simpletable = append(simpletable, []string{check.GetNamespace(), fmt.Sprintf("FinalGoDepsCheckOk() err(%v)", err)})
+ continue
+ }
+ log.Info("FIND NEXT: GOOD TO GO ON", check.GetNamespace())
+ // setCurrentRepo(check, "should be good to release", "pretty sure")
+ trythese = append(trythese, check)
+ }
+
+ footer := cobol.SimpleTable(simpletable)
+ log.Info("reasons against publishing:", footer)
+ return trythese
+}