try to probe the git go package type
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
b4a571fb70
commit
e7a3ef1298
13
common.go
13
common.go
|
@ -1,6 +1,8 @@
|
||||||
package repostatus
|
package repostatus
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"strings"
|
||||||
|
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
// "go.wit.com/gui/gui"
|
// "go.wit.com/gui/gui"
|
||||||
)
|
)
|
||||||
|
@ -69,3 +71,14 @@ func (rs *RepoStatus) Initialized() bool {
|
||||||
return true
|
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 ""
|
||||||
|
}
|
||||||
|
|
5
unix.go
5
unix.go
|
@ -14,6 +14,7 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"go.wit.com/lib/gui/shell"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -120,7 +121,7 @@ func splitVersion(version string) (a, b, c string) {
|
||||||
|
|
||||||
func (rs *RepoStatus) RunCmd(parts []string) (error, string) {
|
func (rs *RepoStatus) RunCmd(parts []string) (error, string) {
|
||||||
path := rs.realPath.String()
|
path := rs.realPath.String()
|
||||||
err, _, output := RunCmd(path, parts)
|
err, _, output := shell.RunCmd(path, parts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Log(WARN, "cmd:", parts)
|
log.Log(WARN, "cmd:", parts)
|
||||||
log.Log(WARN, "ouptput:", output)
|
log.Log(WARN, "ouptput:", output)
|
||||||
|
@ -131,7 +132,7 @@ func (rs *RepoStatus) RunCmd(parts []string) (error, string) {
|
||||||
|
|
||||||
// temp hack. fix this
|
// temp hack. fix this
|
||||||
func runCmd(path string, parts []string) (error, bool, string) {
|
func runCmd(path string, parts []string) (error, bool, string) {
|
||||||
return RunCmd(path, parts)
|
return shell.RunCmd(path, parts)
|
||||||
}
|
}
|
||||||
|
|
||||||
func RunCmd(workingpath string, parts []string) (error, bool, string) {
|
func RunCmd(workingpath string, parts []string) (error, bool, string) {
|
||||||
|
|
Loading…
Reference in New Issue