From 2f6b497b12ada0b920fb61f80a5756c3aded599a Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 29 May 2025 19:18:12 -0500 Subject: [PATCH] fixes do to 'go mod' behavior changes --- Makefile | 3 +++ http.go | 1 + prepareRelease.go | 35 +++++++++++++++++++++++++++-------- structs.go | 21 +++++++++++---------- 4 files changed, 42 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 38b2de8..5a45d86 100644 --- a/Makefile +++ b/Makefile @@ -93,3 +93,6 @@ safe-build: install wit-test install --verbose # cd ~/go/src/go.wit.com/lib/xgb/ && time GUIRELEASE_REASON="safe-build" guireleaser --gui gocui --gui-verbose --gui-file ../../toolkits/gocui/gocui.so >/tmp/forge.log 2>&1 cd ~/go/src/go.wit.com/lib/xgb/ && time GUIRELEASE_REASON="safe-build" guireleaser --gui andlabs + +autocomplete: + guireleaser --bash > ~/.local/share/bash-completion/completions/guireleaser diff --git a/http.go b/http.go index 648b04b..ed5b110 100644 --- a/http.go +++ b/http.go @@ -93,6 +93,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) { } testGoRepo(check) me.forge.HumanPrintRepo(check) + log.Info("upgrade reason:", me.reason[check]) return case "/list": me.forge.PrintHumanTable(me.found) diff --git a/prepareRelease.go b/prepareRelease.go index 704e10d..ff59fbd 100644 --- a/prepareRelease.go +++ b/prepareRelease.go @@ -53,10 +53,10 @@ func rillPurge(repo *gitpb.Repo) error { return nil } - _, err := repo.RunQuiet([]string{"go-mod-clean", "--purge"}) + _, err := repo.RunQuiet([]string{"go-mod-clean", "purge"}) rillcount += 1 if err != nil { - log.Info("go-mod-clean --smart failed", repo.GetGoPath(), err) + log.Info("go-mod-clean purge failed", repo.GetGoPath(), err) return err } return nil @@ -72,18 +72,18 @@ func rillRestore(repo *gitpb.Repo) error { var err error if argv.Verbose { - log.Info("go-mod-clean --smart START", repo.GetGoPath()) - result := repo.RunRealtime([]string{"go-mod-clean", "--smart"}) - log.Info("go-mod-clean --smart END", repo.GetGoPath()) + log.Info("go-mod-clean lax START", repo.GetGoPath()) + result := repo.RunRealtime([]string{"go-mod-clean", "lax"}) + log.Info("go-mod-clean lax END", repo.GetGoPath()) if result.Exit != 0 { err = fmt.Errorf("repo %s failed %d", repo.GetGoPath(), result.Exit) } } else { - _, err = repo.RunQuiet([]string{"go-mod-clean", "--smart"}) + _, err = repo.RunQuiet([]string{"go-mod-clean", "lax"}) } rillcount += 1 if err != nil { - log.Info("go-mod-clean --smart failed", repo.GetGoPath(), err) + log.Info("go-mod-clean lax failed", repo.GetGoPath(), err) return err } return nil @@ -93,8 +93,9 @@ func rePrepareRelease() { // reload the config // me.forge = forgepb.Init() me.found = new(gitpb.Repos) + me.reason = make(map[*gitpb.Repo]string) // stores the reason repos need to be versioned & released - log.Printf("rePrepareRelease() START rill go-mod-clean --smart (11 seconds?)") + log.Printf("rePrepareRelease() START rill go-mod-clean lax (11 seconds?)") rillcount = 0 forgepb.RillX = 2 forgepb.RillY = 2 @@ -176,6 +177,7 @@ func rePrepareRelease() { log.Printf("NEED RELEASE FOR %-50s tag %s != %s\n", check.GetGoPath(), master, lastTag) forceReleaseVersion(check) me.found.AppendByGoPath(check) + me.reason[check] = "master != lastTag" continue } @@ -197,6 +199,7 @@ func rePrepareRelease() { // if --protobuf, this will force upgrade each one forceReleaseVersion(check) me.found.AppendByGoPath(check) + me.reason[check] = "protobuf repo deps changed" continue } @@ -211,6 +214,7 @@ func rePrepareRelease() { log.Printf("NEED RELEASE FOR %-50s err: %v\n", check.GetGoPath(), err) forceReleaseVersion(check) me.found.AppendByGoPath(check) + me.reason[check] = "FinalGoDepsCheckOk() failed even though master tag == last tag" } } @@ -238,6 +242,21 @@ func alreadyDone(repo *gitpb.Repo) bool { return false } +/* +func upgradeReason(repo *gitpb.Repo) string { + for _, gopath := range me.reason { + // log.Info("WARNING already done", gopath, repo.GetGoPath()) + // log.Info("WARNING already done", gopath, repo.GetGoPath()) + // log.Info("WARNING already done", gopath, repo.GetGoPath()) + if repo.GetGoPath() == gopath { + log.Info("FOUND. RETURN TRUE. already done", gopath, repo.GetGoPath()) + return true + } + } + return false +} +*/ + func checkPublishedGodeps(repo *gitpb.Repo) error { godepsOld, err := repo.GoSumFromPkgDir() if err != nil { diff --git a/structs.go b/structs.go index 733fc8d..61b134a 100644 --- a/structs.go +++ b/structs.go @@ -12,16 +12,17 @@ import ( var me *autoType type autoType struct { - pp *arg.Parser // for parsing the command line args. Yay to alexf lint! - myGui *gui.Node // the gui handle itself - releaseReasonS string // = "gocui dropdown select" - release releaseStruct // notsure - reposbox *gui.Node // notsure - reposgrid *gui.Node // notsure - reposgroup *gui.Node // notsure - current *gitpb.Repo // tracks the next repo to publish - found *gitpb.Repos // stores the list of repos to process things on - done []string // gopaths for repos already published + pp *arg.Parser // for parsing the command line args. Yay to alexf lint! + myGui *gui.Node // the gui handle itself + releaseReasonS string // = "gocui dropdown select" + release releaseStruct // notsure + reposbox *gui.Node // notsure + reposgrid *gui.Node // notsure + reposgroup *gui.Node // notsure + current *gitpb.Repo // tracks the next repo to publish + found *gitpb.Repos // stores the list of repos to process things on + done []string // gopaths for repos already published + reason map[*gitpb.Repo]string // the reason this package is going to be updated // this is the repo we are starting in // make sure it never changes so go.mod and go.sum are always there