diff options
Diffstat (limited to 'doRelease.go')
| -rw-r--r-- | doRelease.go | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/doRelease.go b/doRelease.go index ddf25dd..0021ecb 100644 --- a/doRelease.go +++ b/doRelease.go @@ -2,6 +2,8 @@ package main import ( + "errors" + "fmt" "os" "strings" "time" @@ -51,15 +53,16 @@ func doRelease() bool { return false } if !me.forge.FinalGoDepsCheckOk(check) { - log.Info("the go.mod file is wrong. fix it here?", check.GetGoPath()) - os.Exit(-1) + msg := fmt.Sprint("the go.mod file is wrong. fix it here?", check.GetGoPath()) + badExit(errors.New(msg)) 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) + msg := fmt.Sprint("CAN NOT SELF UPDATE.", check.GoPath, "is the same as os.Getwd()") + badExit(errors.New(msg)) } if !me.startRepo.Exists("go.mod") { log.Info("go.sum missing in", me.startRepo.GoPath) @@ -73,7 +76,8 @@ func doRelease() bool { if err := check.ValidGoSum(); err != nil { log.Info("ValidGoSum() error", check.GoPath, err) - os.Exit(-1) + msg := fmt.Sprint("ValidGoSum() error", check.GoPath, err) + badExit(errors.New(msg)) } var all [][]string @@ -91,7 +95,8 @@ func doRelease() bool { if err != nil { log.Info("\tERROR: There are protobuf files, but they are not compiled") log.Info("\tERROR: can not continue") - os.Exit(-1) + msg := fmt.Sprint("ERROR: There are protobuf files, but they are not compiled") + badExit(errors.New(msg)) } log.Info("\tshould add the protobuf files here") log.Info("\tcompiled files found:", compiled) @@ -112,7 +117,8 @@ func doRelease() bool { cname := check.GetCurrentBranchName() if err := check.AutogenSave(autogen, cname, true); err != nil { log.Info("AutogenSave() error", err) - os.Exit(-1) + msg := fmt.Sprint("AutogenSave() error", err) + badExit(errors.New(msg)) } if !me.current.Status.DoAll(all) { @@ -145,7 +151,6 @@ func doRelease() bool { } } */ - me.forge.Repos.ConfigSave() } log.Info("PUBLISH OK") @@ -181,7 +186,8 @@ func doRelease() bool { newtag := me.release.version.String() if err := check.AutogenSave(autogen, newtag, true); err != nil { log.Info("AutogenSave() error", err) - os.Exit(-1) + msg := fmt.Sprint("AutogenSave() error", err) + badExit(errors.New(msg)) } // it's necessary to recreate the the files here @@ -253,7 +259,8 @@ func doPublishVersion() bool { log.Info("CAN NOT SELF UPDATE. cmd =", docmd) log.Info("go get must be run from somewhere else other than startRepo") log.Info("chdir to autotypist if it exists") - os.Exit(-1) + msg := fmt.Sprint("CAN NOT SELF UPDATE. cmd =", docmd) + badExit(errors.New(msg)) } // publish go.mod & go.sum for use with go os.Unsetenv("GO111MODULE") |
