From 1c8f55d397acb6b653d83f050d15329d7de33bfd Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 13 Dec 2024 20:32:07 -0600 Subject: move checks to panic in safer places --- doRelease.go | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'doRelease.go') diff --git a/doRelease.go b/doRelease.go index 6713259..ddf25dd 100644 --- a/doRelease.go +++ b/doRelease.go @@ -55,6 +55,19 @@ func doRelease() bool { os.Exit(-1) return false } + if check.GoPath == me.startRepo.GoPath { + log.Info("CAN NOT SELF UPDATE.", check.GoPath, "is the same as os.Getwd()") + log.Info("go get must be run from somewhere else other than startRepo") + log.Info("chdir to autotypist if it exists") + os.Exit(-1) + } + if !me.startRepo.Exists("go.mod") { + log.Info("go.sum missing in", me.startRepo.GoPath) + log.Info("pick a different repo here") + log.Info("todo: error out earlier knowing this will upgrade") + log.Info("versions", me.startRepo.GetTargetVersion(), me.startRepo.GetMasterVersion()) + panic("redo go.sum") + } log.Info("\ttag and push", curName, me.release.version.String(), me.releaseReasonS) @@ -180,8 +193,10 @@ func doRelease() bool { // attempt to find another repo to release if !doReleaseFindNext() { - log.Info("doReleaseFindNext() could not find a new") - log.Info("THIS PROBABLY MEANS THAT ACTUALLY WE ARE TOTALLY DONE?") + log.Info("doReleaseFindNext() could not find a new", findCounter) + log.Info("THIS PROBABLY MEANS THAT ACTUALLY WE ARE TOTALLY DONE?", findCounter) + count := PrintReleaseReport("", "") + log.Info("count =", count) os.Setenv("FindNextDone", "true") return false } @@ -226,13 +241,6 @@ func doPublishVersion() bool { docmd := []string{"go", "get", "-v", gopath + "@" + me.release.version.String()} log.Info("SHOULD RUN cmd HERE:", docmd) - if !me.startRepo.Exists("go.mod") { - log.Info("go.sum missing in", me.startRepo.GoPath) - log.Info("pick a different repo here") - log.Info("todo: error out earlier knowing this will upgrade") - log.Info("versions", me.startRepo.GetTargetVersion(), me.startRepo.GetMasterVersion()) - panic("redo go.sum") - } if me.current.Status.IsPrivate() { // do not self update private repos log.Info("This is a private repo and can not be self checked") @@ -243,7 +251,7 @@ func doPublishVersion() bool { var result cmd.Status if gopath == me.startRepo.GoPath { log.Info("CAN NOT SELF UPDATE. cmd =", docmd) - log.Info("go get must be run from somewhere else other than guireleaser") + log.Info("go get must be run from somewhere else other than startRepo") log.Info("chdir to autotypist if it exists") os.Exit(-1) } -- cgit v1.2.3