summaryrefslogtreecommitdiff
path: root/common.go
diff options
context:
space:
mode:
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 ""
+}