diff options
| author | Jeff Carr <[email protected]> | 2024-11-28 21:04:10 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-11-28 21:04:10 -0600 |
| commit | 3b90d979d73da9896570d2dc927e05e769b9670b (patch) | |
| tree | b9306baa9ebd24d873aea30712b0944c2667f578 /godep.redoGoMod.go | |
| parent | 02b9ed57b3e1cff11d4ac45c4078900e8ab9685e (diff) | |
init things from here
Diffstat (limited to 'godep.redoGoMod.go')
| -rw-r--r-- | godep.redoGoMod.go | 15 |
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 +} |
