summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-11-08 06:45:12 -0600
committerJeff Carr <[email protected]>2024-11-08 06:45:12 -0600
commita68b3400a5d63f587e11d6b2505bfdd48b461cd8 (patch)
treed702e351303165cef3caa40c20318ce6a43c768f
parentf189efd9d7fb73b78b3cdf0cf398affc06956304 (diff)
use go-cmd/cmdv0.22.11
-rw-r--r--doRelease.go66
-rw-r--r--releaseBox.go4
2 files changed, 37 insertions, 33 deletions
diff --git a/doRelease.go b/doRelease.go
index a6fb2a7..17efc39 100644
--- a/doRelease.go
+++ b/doRelease.go
@@ -6,6 +6,8 @@ import (
"path/filepath"
"strings"
+ "github.com/go-cmd/cmd"
+
"go.wit.com/lib/gui/repolist"
"go.wit.com/lib/gui/shell"
"go.wit.com/log"
@@ -149,12 +151,12 @@ func doReleaseFindNext() bool {
// to insert the new version
func doPublishVersion() bool {
gopath := me.current.GoPath()
- cmd := []string{"go", "get", "-v", gopath + "@" + me.release.version.String()}
- log.Info("SHOULD RUN cmd HERE:", cmd)
+ docmd := []string{"go", "get", "-v", gopath + "@" + me.release.version.String()}
+ log.Info("SHOULD RUN cmd HERE:", docmd)
// right now, you can't publish this because the go.* files in this project are screwed up
if me.release.guireleaser == nil {
- log.Info("CAN NOT SELF UPDATE HERE. cmd =", cmd)
+ log.Info("CAN NOT SELF UPDATE HERE. cmd =", docmd)
return false
}
homeDir, _ := os.UserHomeDir()
@@ -163,37 +165,39 @@ func doPublishVersion() bool {
log.Info("go.sum must exist here")
me.release.guireleaser.Status.MakeRedomod()
}
- var err error
- var out string
if me.current.Status.IsPrivate() {
// do not self update private repos
- err = nil
- out = "This is a private repo and can not be self checked"
+ log.Info("This is a private repo and can not be self checked")
+ return true
+ }
+
+ // try to pull from google
+ var result cmd.Status
+ if gopath == "go.wit.com/apps/guireleaser" {
+ log.Info("CAN NOT SELF UPDATE. cmd =", docmd)
+ log.Info("go get must be run from somewhere else other than guireleaser")
+ result = shell.PathRun("/home/jcarr/go/src/go.wit.com/apps/autotypist", docmd)
} else {
- if gopath == "go.wit.com/apps/guireleaser" {
- log.Info("CAN NOT SELF UPDATE. cmd =", cmd)
- log.Info("go get must be run from somewhere else other than guireleaser")
- err, ok, output := shell.RunCmd("", cmd)
- log.Info("err =", err)
- log.Info("ok =", ok)
- log.Info("output =", output)
- } else {
- // publish go.mod & go.sum for use with go
- os.Unsetenv("GO111MODULE")
- log.Info("TRYING TO SELF UPDATE HERE. cmd =", cmd)
- err, out = me.release.guireleaser.Status.RunCmd(cmd)
- if gopath == "go.wit.com/apps/guireleaser" {
- // ignore errors on updating myself
- log.Info("IGNORE SELF UPDATE ERROR. cmd =", cmd)
- err = nil
- }
- }
+ // publish go.mod & go.sum for use with go
+ os.Unsetenv("GO111MODULE")
+ log.Info("TRYING TO SELF UPDATE HERE. cmd =", docmd)
+ result = me.release.guireleaser.Status.Run(docmd)
}
- if err == nil {
- log.Info("SELF UPDATE OK. out =", out)
- log.Info("SELF UPDATE WORKED")
- // me.current.SetGoState("RELEASED")
- return true
+ if result.Error != nil {
+ log.Info("SELF UPDATE FAILED. error =", result.Error)
+ log.Info("SELF UPDATE FAILED. exit =", result.Exit)
+ log.Info("SELF UPDATE FAILED. out =", result.Stdout)
+ log.Info("SELF UPDATE FAILED")
+ return false
}
- return false
+ if result.Exit != 0 {
+ log.Info("SELF UPDATE FAILED. error =", result.Error)
+ log.Info("SELF UPDATE FAILED. exit =", result.Exit)
+ log.Info("SELF UPDATE FAILED. out =", result.Stdout)
+ log.Info("SELF UPDATE FAILED")
+ return false
+ }
+ log.Info("SELF UPDATE OK. out =", result.Stdout)
+ log.Info("SELF UPDATE WORKED")
+ return true
}
diff --git a/releaseBox.go b/releaseBox.go
index a3e0849..14b0c94 100644
--- a/releaseBox.go
+++ b/releaseBox.go
@@ -178,7 +178,7 @@ func createReleaseBox(box *gui.Node) {
if repo.Status.ReadOnly() {
continue
}
- repo.Status.RunCmd([]string{"rm", "-f", "go.mod", "go.sum"})
+ repo.Status.Run([]string{"rm", "-f", "go.mod", "go.sum"})
}
me.Enable()
})
@@ -191,7 +191,7 @@ func createReleaseBox(box *gui.Node) {
continue
}
log.Warn("running git reset --hard", repo.Name())
- repo.Status.RunCmd([]string{"git", "reset", "--hard"})
+ repo.Status.Run([]string{"git", "reset", "--hard"})
}
me.Enable()
})