From 90f2a202d54ce8a66c7ff5ed1c7e65f646f40471 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 14 Nov 2024 21:46:45 -0600 Subject: [PATCH] use Scan() --- globalResetOptions.go | 11 +++++++---- repoview.go | 8 ++++++-- tagWindow.go | 9 ++++++--- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/globalResetOptions.go b/globalResetOptions.go index 2c53822..d6ab747 100644 --- a/globalResetOptions.go +++ b/globalResetOptions.go @@ -8,7 +8,6 @@ import ( "strings" "go.wit.com/gui" - "go.wit.com/lib/gui/repolist" "go.wit.com/log" ) @@ -31,7 +30,9 @@ func globalResetOptions(box *gui.Node) { fmt.Fprintln(f, "go 1.21.4") fmt.Fprintln(f, "") fmt.Fprintln(f, "use (") - for _, repo := range repolist.AllRepos() { + loop := me.repos.View.ReposSortByName() + for loop.Scan() { + repo := loop.Repo() if repo.Status.Exists("go.mod") { fmt.Fprintln(f, "\t"+repo.Status.GoPath()) } else { @@ -108,8 +109,9 @@ func globalResetOptions(box *gui.Node) { }) grid.NextRow() - grid.NewLabel("start over") - me.deleteGoSrcPkgB = grid.NewButton("rm ~/go/src & ~/go/pkg", func() { + // this dumps everything + grid.NewLabel("clean start over") + me.deleteGoSrcPkgB = grid.NewButton("rm ~/go/src & ~/go/pkg & ~/.cache/go-build", func() { var state string = me.deleteGoSrcPkgB.String() loop := me.repos.View.ReposSortByName() for loop.Scan() { @@ -148,6 +150,7 @@ func globalResetOptions(box *gui.Node) { quickCmd(fullpath, []string{"rm", "-rf", gosrc}) quickCmd(fullpath, []string{"chmod", "700", "-R", gopkg}) quickCmd(fullpath, []string{"rm", "-rf", gopkg}) + quickCmd(homeDir, []string{"rm", "-rf", ".cache/go-build/"}) if me.autoDryRun.Checked() { me.deleteGoSrcPkgB.SetLabel("rm ~/go/src (uncheck dry-run)") return diff --git a/repoview.go b/repoview.go index 03b91b2..22b9dde 100644 --- a/repoview.go +++ b/repoview.go @@ -132,7 +132,9 @@ func (r *repoWindow) repoMenu() *gui.Node { func (r *repoWindow) mergeAllDevelToMain() bool { log.Info("merge all here") - for _, repo := range r.View.AllRepos() { + loop := me.repos.View.ReposSortByName() + for loop.Scan() { + repo := loop.Repo() if repo.ReadOnly() { log.Info("skipping readonly", repo.Name(), repo.State()) continue @@ -162,7 +164,9 @@ func (r *repoWindow) mergeAllDevelToMain() bool { func (r *repoWindow) mergeAllUserToDevel() bool { log.Info("merge all here") - for _, repo := range r.View.AllRepos() { + loop := me.repos.View.ReposSortByName() + for loop.Scan() { + repo := loop.Repo() if repo.ReadOnly() { log.Info("skipping readonly", repo.Name(), repo.State()) continue diff --git a/tagWindow.go b/tagWindow.go index f34be05..bb04127 100644 --- a/tagWindow.go +++ b/tagWindow.go @@ -5,7 +5,6 @@ import ( "go.wit.com/log" "go.wit.com/lib/gadgets" - "go.wit.com/lib/gui/repolist" "go.wit.com/lib/gui/repostatus" ) @@ -47,7 +46,9 @@ func makeTagWindow() *tagWindow { topGrid.NewButton("list all tags", func() { me.autotypistWindow.Disable() defer me.autotypistWindow.Enable() - for _, repo := range repolist.AllRepos() { + loop := me.repos.View.ReposSortByName() + for loop.Scan() { + repo := loop.Repo() allTags := repo.AllTags() for _, t := range allTags { log.Info("found tag:", t.TagString(), "from", repo.Name()) @@ -58,7 +59,9 @@ func makeTagWindow() *tagWindow { topGrid.NewButton("delete all dup tags", func() { me.autotypistWindow.Disable() defer me.autotypistWindow.Enable() - for _, repo := range repolist.AllRepos() { + loop := me.repos.View.ReposSortByName() + for loop.Scan() { + repo := loop.Repo() if repo.GoPath() == "go.wit.com/lib/gadgets" { // only do log for now } else {