summaryrefslogtreecommitdiff
path: root/common.go
diff options
context:
space:
mode:
Diffstat (limited to 'common.go')
-rw-r--r--common.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/common.go b/common.go
index 6392eea..bd1cc60 100644
--- a/common.go
+++ b/common.go
@@ -1,6 +1,7 @@
package repostatus
import (
+ "os"
"strings"
"unicode"
@@ -111,10 +112,15 @@ func (rs *RepoStatus) IsGoLang() bool {
return false
}
+// experiment to go package type
func (rs *RepoStatus) RepoType() string {
if !rs.IsGoLang() {
return ""
}
+ if !rs.Exists("go.mod") {
+ 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, "'")