summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-12-13 20:32:07 -0600
committerJeff Carr <[email protected]>2024-12-13 20:32:07 -0600
commit1c8f55d397acb6b653d83f050d15329d7de33bfd (patch)
treeebf6830cf93235c2eda427a90c09aae9fdf60c9b
parentd1708d6a4bea44c9935e0b26e7d3e3a209c3b4b1 (diff)
move checks to panic in safer placesv0.22.36
-rw-r--r--doRelease.go28
-rw-r--r--human.go3
-rw-r--r--main.go8
3 files changed, 26 insertions, 13 deletions
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)
}
diff --git a/human.go b/human.go
index 5b2aaf9..942c578 100644
--- a/human.go
+++ b/human.go
@@ -55,7 +55,7 @@ func PrintReport(readonly string, onlydirty string, perfect string) {
log.Info(fmt.Sprintf("EVERYTHING WORKED repo count = %d", count))
}
-func PrintReleaseReport(readonly string, perfect string) {
+func PrintReleaseReport(readonly string, perfect string) int {
var count int
log.Info(repolist.ReleaseReportHeader())
@@ -81,4 +81,5 @@ func PrintReleaseReport(readonly string, perfect string) {
log.Info(me.forge.StandardReleaseHeader(check, state))
}
log.Info(fmt.Sprintf("total repo count = %d", count))
+ return count
}
diff --git a/main.go b/main.go
index 6b6a74e..4fce146 100644
--- a/main.go
+++ b/main.go
@@ -4,6 +4,7 @@ import (
"embed"
"os"
"path/filepath"
+ "strings"
"go.wit.com/dev/alexflint/arg"
"go.wit.com/gui"
@@ -111,10 +112,13 @@ func main() {
}
}
- me.startRepo = me.forge.Repos.FindByGoPath("go.wit.com/apps/helloworld")
+ pwd, _ := os.Getwd()
+ basedir := strings.TrimPrefix(pwd, me.forge.GetGoSrc())
+ basedir = strings.Trim(basedir, "/")
+ me.startRepo = me.forge.Repos.FindByGoPath(basedir)
if me.startRepo == nil {
- log.Info("Can not release if guireleaser was not found")
+ log.Info("Can not run if pwd is not a repo", basedir)
os.Exit(0)
}
me.Enable()