From ad2c989f77fac21e12d17e00998a0ff5e8be1989 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 1 Feb 2024 15:16:15 -0600 Subject: [PATCH] updates with golang systems correctly Signed-off-by: Jeff Carr --- checkReady.go | 4 ++-- releaseWindow.go | 28 ++++++++++++++++++++++++++-- scan.go | 5 +++++ 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/checkReady.go b/checkReady.go index 0e7ff27..3cef23b 100644 --- a/checkReady.go +++ b/checkReady.go @@ -49,7 +49,7 @@ func CheckReady() bool { } return true } - if goSumS == "UNCHANGED" { + if goSumS == "UNRELEASED" { return true } if goSumS == "READY" { @@ -58,7 +58,7 @@ func CheckReady() bool { return true } if lastS == currentS { - release.current.setGoSumStatus("UNCHANGED") + release.current.setGoSumStatus("UNRELEASED") } return true } diff --git a/releaseWindow.go b/releaseWindow.go index 9be9aea..252d3f8 100644 --- a/releaseWindow.go +++ b/releaseWindow.go @@ -41,6 +41,10 @@ type releaseStruct struct { sendVersionB *gui.Node checkSafeB *gui.Node whitelist map[string]*repo + + // store myself here. use myself to + // do garbage go get tests and other potential junk + guireleaser *repo } func (w *autoType) Disable() { @@ -105,6 +109,10 @@ func createReleaseBox(box *gui.Node) { log.Warn("attempting to release. TODO: recheck go.sum here", release.version.String()) log.Warn("Sleep 10") log.Sleep(10) + case "UNRELEASED": + log.Warn("attempting to release. TODO: dig deep on go.sum here", release.version.String()) + log.Warn("Sleep 10") + log.Sleep(10) default: log.Warn("what is this?", release.version.String(), release.status.String()) return @@ -140,14 +148,24 @@ func createReleaseBox(box *gui.Node) { log.Info("EVERYTHING OK") release.current.setGoSumStatus("RELEASED") - os.Unsetenv("GO111MODULE") gopath := release.current.String() cmd := []string{"go", "get", "-v", gopath + "@" + release.version.String()} log.Info("SHOULD RUN cmd HERE to update myself:", cmd) log.Info("SHOULD RUN cmd HERE:", cmd) log.Info("SHOULD RUN cmd HERE:", cmd) - // release.current.status.RunCmd( + if release.guireleaser != nil { + os.Unsetenv("GO111MODULE") + log.Info("TRYING TO SELF UPDATE HERE. cmd =", cmd) + err, out := release.guireleaser.status.RunCmd(cmd) + if err == nil { + log.Info("SELF UPDATE WORKED\n", out) + } else { + log.Info("SELF UPDATE FAILED err =", err) + log.Info("SELF UPDATE FAILED out =", out) + return + } + } buttonEnable() } else { log.Info("SOMETHING FAILED") @@ -428,6 +446,12 @@ func findNextDirty() bool { if goSumS == "IGNORE" { continue } + if goSumS == "UNRELEASED" { + if setCurrentRepo(repo, "UNRELEASED", "manually check go.sum") { + return true + } + continue + } if goSumS == "NOT READY" { if setCurrentRepo(repo, "NOT READY", "manually check go.sum") { return true diff --git a/scan.go b/scan.go index b0233be..2d2f78f 100644 --- a/scan.go +++ b/scan.go @@ -74,6 +74,11 @@ func (r *repo) checkSafeGoSumRemake() { func scanGoSum() { for _, repo := range me.allrepos { + if repo.String() == "go.wit.com/apps/guireleaser" { + if release.guireleaser == nil { + release.guireleaser = repo + } + } latestversion := repo.status.GetLastTagVersion() if repo.getGoSumStatus() == "BAD" { continue