diff --git a/globalBuildOptions.go b/globalBuildOptions.go index 8257da6..043892e 100644 --- a/globalBuildOptions.go +++ b/globalBuildOptions.go @@ -40,7 +40,10 @@ func quickCmd(fullpath string, cmd []string) bool { err, b, output = repostatus.RunCmd(fullpath, cmd) if err != nil { - log.Error(err) + log.Warn("cmd =", cmd) + log.Warn("err =", err) + log.Warn("b =", b) + log.Warn("output =", string(output)) return false } else if !b { log.Warn("b =", b) diff --git a/listWindow.go b/listWindow.go index 3432776..943dde8 100644 --- a/listWindow.go +++ b/listWindow.go @@ -85,6 +85,27 @@ func listWindow() { // lw.Toggle() } +func downloadRepo(path string) bool { + log.Info("downloading", path, "here") + os.Setenv("GO111MODULE", "off") + + goSrcDir := me.goSrcPwd.String() + if ! quickCmd(goSrcDir, []string{"go", "get", "-v", path}) { + log.Info("go get failed") + return false + } + + fullpath := filepath.Join(goSrcDir, path) + if ! quickCmd(fullpath, []string{"go", "get", "-v", "-u", "."}) { + log.Info("go get depends failed") + return false + } + if me.autoDryRun.Checked() { + return false + } + return true +} + func (s *section) add(path string) { if s == nil { return @@ -94,14 +115,16 @@ func (s *section) add(path string) { tmp.path = s.grid.NewLabel(path) tmp.downloadB = s.grid.NewButton("download", func() { lw.Disable() - log.Info("downloading", tmp.path.String(), "here") - os.Setenv("GO111MODULE", "off") - - goSrcDir := me.goSrcPwd.String() - quickCmd(goSrcDir, []string{"go", "get", "-v", tmp.path.String()}) - - fullpath := filepath.Join(goSrcDir, tmp.path.String()) - quickCmd(fullpath, []string{"go", "get", "-v", "-u", "."}) + if me.autoDryRun.Checked() { + tmp.downloadB.SetLabel("uncheck --dry-run") + } + if downloadRepo(tmp.path.String()) { + log.Info("download", tmp.path.String(), "worked") + tmp.downloadB.SetLabel("downloaded") + tmp.downloadB.Disable() + } else { + log.Info("download", tmp.path.String(), "failed") + } lw.Enable() }) if repostatus.VerifyLocalGoRepo(path) {