summaryrefslogtreecommitdiff
path: root/repoType.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-12-17 01:15:31 -0600
committerJeff Carr <[email protected]>2024-12-17 01:15:31 -0600
commit4bc95ad2684cb42159229b8198aa8a2377f80aa1 (patch)
tree57c4b95880302bfd3a34d0cc3eec6ab79f1d0993 /repoType.go
parentc53da5a9a1da1b29db24d4e1ce2b294514d99ac2 (diff)
keep isolating use of os.Exec("git")
Diffstat (limited to 'repoType.go')
-rw-r--r--repoType.go48
1 files changed, 0 insertions, 48 deletions
diff --git a/repoType.go b/repoType.go
deleted file mode 100644
index 52846d2..0000000
--- a/repoType.go
+++ /dev/null
@@ -1,48 +0,0 @@
-package gitpb
-
-// does processing on the go.mod and go.sum files
-
-import (
- "os"
- "strings"
-
- "go.wit.com/log"
-)
-
-func (repo *Repo) RepoType() string {
- if repo == nil {
- return "nil"
- }
- if repo.GetGoPlugin() {
- return "plugin"
- }
- if repo.GetGoBinary() {
- if repo.Exists(".plugin") {
- return "plugin"
- }
- return "binary"
- }
- if ok, _, _ := repo.IsProtobuf(); ok {
- return "protobuf"
- }
- if repo.GetGoLibrary() {
- return "library"
- }
- return ""
-}
-
-func (repo *Repo) goListRepoType() 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
-}