summaryrefslogtreecommitdiff
path: root/common.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-11-08 06:43:33 -0600
committerJeff Carr <[email protected]>2024-11-08 06:43:33 -0600
commit55acea0bd769132db7bf420fef3b94fa21ca5f83 (patch)
treed43fb2b485cf0b1439a48037cf129a76e1d53ad0 /common.go
parent29545d3f048ccb148429725d76d0894336985c2b (diff)
use go-cmd/cmdv0.22.12
Diffstat (limited to 'common.go')
-rw-r--r--common.go18
1 files changed, 8 insertions, 10 deletions
diff --git a/common.go b/common.go
index 4e52032..c6d8995 100644
--- a/common.go
+++ b/common.go
@@ -87,7 +87,7 @@ func (rs *RepoStatus) IsProtobuf() (bool, []string, error) {
if found {
// log.Info("found ok")
} else {
- log.Info("missing compiled proto file:", pname + "pb.go")
+ log.Info("missing compiled proto file:", pname+"pb.go")
err = errors.New("compiled file " + pname + ".pb.go missing")
}
}
@@ -155,7 +155,7 @@ func (rs *RepoStatus) IsGoLang() bool {
return false
}
-// experiment to go package type
+// experiment to determine the golang package type
func (rs *RepoStatus) RepoType() string {
if !rs.IsGoLang() {
return ""
@@ -164,14 +164,12 @@ func (rs *RepoStatus) RepoType() string {
return ""
}
os.Setenv("GO111MODULE", "off")
- err, output := rs.RunCmd([]string{"go", "list", "-f", "'{{if eq .Name \"main\"}}binary{{else}}library{{end}}'"})
- if err == nil {
- output = strings.Trim(output, "'")
- // log.Info("go package is:", output)
- return output
+ r := rs.Run([]string{"go", "list", "-f", "'{{if eq .Name \"main\"}}binary{{else}}library{{end}}'"})
+ output := strings.TrimSpace(strings.Join(r.Stdout, "\n"))
+ if r.Error != nil {
+ log.Info("go package error:", r.Error)
}
- // log.Info("package is: unknown", err)
- return ""
+ return output
}
func (rs *RepoStatus) BinaryName() string {
@@ -188,7 +186,7 @@ func (rs *RepoStatus) Build() bool {
}
name := rs.BinaryName()
// removes the binary if it already exists
- rs.RunCmd([]string{"rm", "-f", name})
+ rs.Run([]string{"rm", "-f", name})
if rs.Exists(name) {
log.Warn("file could not be removed filename =", name)
return false