From ab73c05b9dd50f491f5ef1b919a464ca2a269aef Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 17 Jan 2025 14:19:26 -0600 Subject: [PATCH] double check finished repos --- doRelease.go | 2 ++ prepareRelease.go | 19 +++++++++++++++++++ structs.go | 20 ++++++++++---------- 3 files changed, 31 insertions(+), 10 deletions(-) diff --git a/doRelease.go b/doRelease.go index f46fb3f..c9ab030 100644 --- a/doRelease.go +++ b/doRelease.go @@ -23,6 +23,8 @@ func doRelease() bool { log.Warn("something went wrong with the release.version:", me.release.version.String()) return false } + me.done = append(me.done, me.current.GetGoPath()) + if strings.HasPrefix(me.release.version.String(), "v") { log.Warn("everything is ok. version starts with v.", me.release.version.String()) } else { diff --git a/prepareRelease.go b/prepareRelease.go index 3b0a03c..8532961 100644 --- a/prepareRelease.go +++ b/prepareRelease.go @@ -108,6 +108,16 @@ func rePrepareRelease() { continue } + if alreadyDone(check) { + // means it was already published + // protects against logic errors that might result + // in an infinite loop + log.Info("WARNING already done", check.GetGoPath()) + log.Info("WARNING already done", check.GetGoPath()) + log.Info("WARNING already done", check.GetGoPath()) + continue + } + if argv.Quick != nil { // if argv has 'quick' don't do anything // that doesn't actually have a patch @@ -139,3 +149,12 @@ func rePrepareRelease() { } me.forge.PrintHumanTable(me.found) } + +func alreadyDone(repo *gitpb.Repo) bool { + for _, gopath := range me.done { + if repo.GetGoPath() == gopath { + return true + } + } + return false +} diff --git a/structs.go b/structs.go index 2631171..4fda32c 100644 --- a/structs.go +++ b/structs.go @@ -12,16 +12,16 @@ import ( var me *autoType type autoType struct { - pp *arg.Parser // for parsing the command line args. Yay to alexf lint! - myGui *gui.Node - - releaseReasonS string // = "gocui dropdown select" - release releaseStruct - reposbox *gui.Node - reposgrid *gui.Node - reposgroup *gui.Node - current *gitpb.Repo - found *gitpb.Repos // stores the list of repos to process things on + 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 // this is the repo we are starting in // make sure it never changes so go.mod and go.sum are always there