summaryrefslogtreecommitdiff
path: root/common.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-02-12 18:16:03 -0600
committerJeff Carr <[email protected]>2024-02-12 18:16:03 -0600
commite7a3ef1298cb50fc69ca2fb61d81b4a74838a2c4 (patch)
tree9a0e1070bb2050cd194d022d12dd8d519c48587e /common.go
parentb4a571fb70905d69161b204784fff77517ee5022 (diff)
try to probe the git go package type
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'common.go')
-rw-r--r--common.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/common.go b/common.go
index 4174a82..31c2e37 100644
--- a/common.go
+++ b/common.go
@@ -1,6 +1,8 @@
package repostatus
import (
+ "strings"
+
"go.wit.com/log"
// "go.wit.com/gui/gui"
)
@@ -69,3 +71,14 @@ func (rs *RepoStatus) Initialized() bool {
return true
}
*/
+
+func (rs *RepoStatus) RepoType() string {
+ 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
+ }
+ log.Info("package is: unknown", err)
+ return ""
+}