summaryrefslogtreecommitdiff
path: root/findNext.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-12-02 05:13:17 -0600
committerJeff Carr <[email protected]>2024-12-02 05:13:17 -0600
commitcfb4fb61bfab6e6816c0080b47d6a6d4b935cea2 (patch)
tree91be3748e0fb1c09cd0fa169d78ef65fc657fcb8 /findNext.go
parent02f7ee387ff083d5c39b3d99ec9defe3e66e3700 (diff)
more rewriting of old code
Diffstat (limited to 'findNext.go')
-rw-r--r--findNext.go77
1 files changed, 54 insertions, 23 deletions
diff --git a/findNext.go b/findNext.go
index b6a3867..9ffb6b7 100644
--- a/findNext.go
+++ b/findNext.go
@@ -41,10 +41,12 @@ func findNext() bool {
continue
}
log.Info("findNext()", repo.GoPath(), "is not a primative repo")
- if ! goodGodeps(repo) {
- continue
+ check := me.forge.Repos.FindByGoPath(repo.GoPath())
+ if check == nil {
+ log.Info("boo, you didn't git clone", repo.GoPath())
+ return false
}
- if checkValidGoSum(repo) {
+ if me.forge.FinalGoDepsCheck(check) {
setCurrentRepo(repo, "should be good to release", "pretty sure")
return true
}
@@ -54,22 +56,20 @@ func findNext() bool {
return false
}
+/*
func checkValidGoSum(repo *repolist.RepoRow) bool {
- ok, err := me.repos.View.CheckValidGoSum(repo)
- if err != nil {
- log.Info("go mod tidy not ok", err)
- return false
- }
- if ok {
+ if goodGodeps(repo) {
log.Info("repo has go.sum requirements that are clean")
// me.current.setGoSumStatus("CLEAN")
me.release.status.SetValue("GOOD")
me.release.notes.SetValue("CheckValidGoSum() does not seem to lie")
return true
}
+ log.Info("go mod tidy not ok")
me.release.notes.SetValue("CheckValidGoSum() failed")
return false
}
+*/
func goodGodeps(repo *repolist.RepoRow) bool {
var good bool = true
@@ -79,7 +79,7 @@ func goodGodeps(repo *repolist.RepoRow) bool {
log.Info("boo, you didn't git clone", repo.GoPath())
os.Exit(-1)
}
- check.RedoGoMod()
+ // check.RedoGoMod()
log.Printf("current repo %s go dependancy count: %d", check.GetGoPath(), check.GoDepsLen())
deps := check.GoDeps.SortByGoPath()
for deps.Scan() {
@@ -103,23 +103,54 @@ func goodGodeps(repo *repolist.RepoRow) bool {
log.Info("bad", header)
good = false
}
+ return good
+}
- /*
- log.Info(repolist.ReleaseReportHeader())
- loop := me.repos.View.ReposSortByName()
- for loop.Scan() {
- repo := loop.Repo()
-
- // if repo.ReadOnly() {
- // continue
- // }
- if repo.Status.IsReleased() {
+// tries to fix the go.mod and go.sum files
+func fixGodeps(repo *repolist.RepoRow) 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)
+ }
+ check.RedoGoMod()
+ log.Printf("current repo %s go dependancy count: %d", check.GetGoPath(), check.GoDepsLen())
+ deps := check.GoDeps.SortByGoPath()
+ for deps.Scan() {
+ depRepo := deps.Next()
+ // log.Info("found dep", depRepo.GetGoPath())
+ if me.forge.IsReadOnly(depRepo.GetGoPath()) {
+ log.Info("IsReadOnly = true", depRepo.GetGoPath())
continue
+ } else {
+ // log.Info("IsReadOnly = false", depRepo.GetGoPath())
+ }
+ found := me.repos.View.FindByPath(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)")
+ cmd := []string{"go", "get", depRepo.GetGoPath() + "@latest"}
+ check.Run(cmd)
}
- header := repo.StandardReleaseHeader()
- log.Info(header)
}
- */
+ cmd := []string{"go", "mod", "tidy"}
+ check.Run(cmd)
+ cmd = []string{"go", "mod", "edit", "-go=1.20"}
+ check.Run(cmd)
+ check.GoDeps = nil
+ check.ParseGoSum()
+ deps = check.GoDeps.SortByGoPath()
+ for deps.Scan() {
+ depRepo := deps.Next()
+ log.Info("found updated dep", depRepo.GetGoPath(), depRepo.GetVersion())
+ }
return good
}