summaryrefslogtreecommitdiff
path: root/godep.redoGoMod.go
diff options
context:
space:
mode:
Diffstat (limited to 'godep.redoGoMod.go')
-rw-r--r--godep.redoGoMod.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/godep.redoGoMod.go b/godep.redoGoMod.go
index 2ce7676..79a86f7 100644
--- a/godep.redoGoMod.go
+++ b/godep.redoGoMod.go
@@ -115,3 +115,18 @@ func (repo *Repo) parseGoSum() (bool, error) {
}
return true, nil
}
+func (repo *Repo) RepoType() string {
+ os.Setenv("GO111MODULE", "off")
+ cmd := []string{"go", "list", "-f", "'{{if eq .Name \"main\"}}binary{{else}}library{{end}}'"}
+ // cmd := []string{"go", "list", "-f", "'{{.Name}}'"} // probably use this. this just prints out the package name
+ // cmd := []string{"go", "list", "-f", "'{{.ImportPath}}'"} // returns go.wit.com/lib/protobuf/gitpb
+
+ result := repo.RunQuiet(cmd)
+ if result.Error != nil {
+ log.Warn("go list binary detect failed", result.Error)
+ return ""
+ }
+ output := strings.TrimSpace(strings.Join(result.Stdout, "\n"))
+ output = strings.Trim(output, "'")
+ return output
+}