From dae2653975b6db822633430a97adbb21b52a99ff Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 11 Dec 2024 19:31:37 -0600 Subject: [PATCH] use 'all' instead of 'loop' --- build.go | 12 ++++++------ cleanGoSum.go | 6 +++--- configLookup.go | 30 +++++++++++++++--------------- gitCheckout.go | 22 +++++++++++----------- goSrcScan.go | 6 +++--- goWork.go | 6 +++--- human.go | 12 ++++++------ patch.Make.go | 12 ++++++------ 8 files changed, 53 insertions(+), 53 deletions(-) diff --git a/build.go b/build.go index 14c9f6f..5b3abf2 100644 --- a/build.go +++ b/build.go @@ -48,9 +48,9 @@ func (f *Forge) doBuild(repo *gitpb.Repo, userFlags []string, goWhat string) err version := repo.GetCurrentBranchVersion() /* - loop := repo.Tags.SortByRefname() - for loop.Scan() { - t := loop.Next() + all := repo.Tags.SortByRefname() + for all.Scan() { + t := all.Next() log.Info("Build() tag:", t.Refname) } */ @@ -66,9 +66,9 @@ func (f *Forge) doBuild(repo *gitpb.Repo, userFlags []string, goWhat string) err } // run autogenpb in all protobuf repos - loop1 := repo.GoDeps.SortByGoPath() - for loop1.Scan() { - t := loop1.Next() + all := repo.GoDeps.SortByGoPath() + for all.Scan() { + t := all.Next() found := f.Repos.FindByGoPath(t.GetGoPath()) if found.RepoType() == "protobuf" { if err := f.runAutogenpb(found); err != nil { diff --git a/cleanGoSum.go b/cleanGoSum.go index bfbf828..c310523 100644 --- a/cleanGoSum.go +++ b/cleanGoSum.go @@ -63,9 +63,9 @@ func (f *Forge) CleanGoDepsCheckOk(check *gitpb.Repo) error { var err error = nil log.Printf("current repo %s go dependancy count: %d", check.GetGoPath(), check.GoDepsLen()) - deps := check.GoDeps.SortByGoPath() - for deps.Scan() { - depRepo := deps.Next() + all := check.GoDeps.SortByGoPath() + for all.Scan() { + depRepo := all.Next() found := f.Repos.FindByGoPath(depRepo.GetGoPath()) if found == nil { if f.checkOverride(depRepo.GetGoPath()) { diff --git a/configLookup.go b/configLookup.go index cda036e..9a61c2e 100644 --- a/configLookup.go +++ b/configLookup.go @@ -37,9 +37,9 @@ func (all *ForgeConfigs) UpdateGoPath(name string, gopath string) bool { func (fc *ForgeConfigs) IsReadOnly(gopath string) bool { var match *ForgeConfig - loop := fc.SortByGoPath() // get the list of repos - for loop.Scan() { - r := loop.Next() + all := fc.SortByGoPath() // get the list of repos + for all.Scan() { + r := all.Next() if r.GoPath == gopath { // exact gopath match if r.Writable { @@ -98,9 +98,9 @@ func (fc *ForgeConfigs) DebName(gopath string) string { // get "zookeeper" from "go.wit.com/apps/zookeeper" normalBase := filepath.Base(gopath) - loop := fc.SortByGoPath() - for loop.Scan() { - r := loop.Next() + all := fc.SortByGoPath() + for all.Scan() { + r := all.Next() if r.GoPath == gopath { // returns "zookeeper-go" for "go.wit.com/apps/zookeeper" if r.DebName != "" { @@ -127,9 +127,9 @@ func (fc *ForgeConfigs) IsPrivate(thing string) bool { // sort by path means the simple 'match' logic // here works in the sense the last directory match // is the one that is used - loop := fc.SortByGoPath() // get the list of repos - for loop.Scan() { - r := loop.Next() + all := fc.SortByGoPath() // get the list of repos + for all.Scan() { + r := all.Next() if r.GoPath == thing { // if private is set here, then ok, otherwise // still check if a Directory match exists @@ -168,9 +168,9 @@ func (fc *ForgeConfigs) IsPrivate(thing string) bool { func (fc *ForgeConfigs) IsFavorite(thing string) bool { var match *ForgeConfig - loop := fc.SortByGoPath() // get the list of repos - for loop.Scan() { - r := loop.Next() + all := fc.SortByGoPath() // get the list of repos + for all.Scan() { + r := all.Next() if r.GoPath == thing { if r.Favorite { return true @@ -201,9 +201,9 @@ func (fc *ForgeConfigs) IsFavorite(thing string) bool { func (fc *ForgeConfigs) IsWritable(thing string) bool { var match *ForgeConfig - loop := fc.SortByGoPath() // get the list of repos - for loop.Scan() { - r := loop.Next() + all := fc.SortByGoPath() // get the list of repos + for all.Scan() { + r := all.Next() if r.GoPath == thing { if r.Writable { return true diff --git a/gitCheckout.go b/gitCheckout.go index 612464f..c994c37 100644 --- a/gitCheckout.go +++ b/gitCheckout.go @@ -13,8 +13,8 @@ func (f *Forge) GitPull() bool { log.Log(FORGEPBWARN, "running git pull everywhere") var failed int = 0 - for loop.Scan() { - repo := loop.Next() + for all.Scan() { + repo := all.Next() if out, err := repo.GitPull(); err == nil { log.Log(FORGEPBWARN, "Ran git pull ok", repo.GetGoPath(), out) } else { @@ -41,9 +41,9 @@ func (f *Forge) CheckoutDevel() bool { log.Log(FORGEPBWARN, "running git checkout devel everwhere") var failed int = 0 var count int = 0 - loop := f.Repos.SortByGoPath() - for loop.Scan() { - repo := loop.Next() + all := f.Repos.SortByGoPath() + for all.Scan() { + repo := all.Next() count += 1 if repo.CheckoutDevel() { // checkout ok @@ -59,9 +59,9 @@ func (f *Forge) CheckoutMaster() bool { log.Log(FORGEPBWARN, "running git checkout master everwhere") var failed int = 0 var count int = 0 - loop := f.Repos.SortByGoPath() - for loop.Scan() { - repo := loop.Next() + all := f.Repos.SortByGoPath() + for all.Scan() { + repo := all.Next() count += 1 if repo.CheckoutMaster() { // checkout ok @@ -77,9 +77,9 @@ func (f *Forge) CheckoutUser() bool { log.Log(FORGEPBWARN, "running git checkout master everwhere") var failed int = 0 var count int = 0 - loop := f.Repos.SortByGoPath() - for loop.Scan() { - repo := loop.Next() + all := f.Repos.SortByGoPath() + for all.Scan() { + repo := all.Next() count += 1 if repo.CheckoutUser() { // checkout ok diff --git a/goSrcScan.go b/goSrcScan.go index d7a6cea..473e36b 100644 --- a/goSrcScan.go +++ b/goSrcScan.go @@ -133,9 +133,9 @@ func (f *Forge) rillScanDirs(gopaths []string) (int, error) { func (f *Forge) RillRedoGoMod() int { var all []*gitpb.Repo - repos := f.Repos.SortByGoPath() - for repos.Scan() { - repo := repos.Next() + tmp := f.Repos.SortByGoPath() + for tmp.Scan() { + repo := tmp.Next() if !repo.IsValid() { log.Printf("%10s %-50s", "old?", repo.GetGoPath()) continue diff --git a/goWork.go b/goWork.go index afd56c9..afb09da 100644 --- a/goWork.go +++ b/goWork.go @@ -27,9 +27,9 @@ func (f *Forge) MakeGoWork() error { fmt.Fprintln(workf, "") fmt.Fprintln(workf, "use (") - loop := f.Repos.SortByGoPath() - for loop.Scan() { - repo := loop.Next() + all := f.Repos.SortByGoPath() + for all.Scan() { + repo := all.Next() /* if !repo.IsGoLang() == "" { // skip repos that aren't go diff --git a/human.go b/human.go index 82ad766..80dd04e 100644 --- a/human.go +++ b/human.go @@ -43,17 +43,17 @@ func (f *Forge) ConfigPrintTable() { return } log.Info(standardHeader()) - loop := f.Config.SortByGoPath() - for loop.Scan() { - r := loop.Next() + all := f.Config.SortByGoPath() + for all.Scan() { + r := all.Next() log.Info(f.standardHeader(r)) } } func (f *Forge) newestAge(repo *gitpb.Repo) time.Duration { - loop := repo.Tags.SortByAge() - for loop.Scan() { - r := loop.Next() + all := repo.Tags.SortByAge() + for all.Scan() { + r := all.Next() return time.Since(r.GetAuthordate().AsTime()) } return time.Since(time.Now()) diff --git a/patch.Make.go b/patch.Make.go index c2d1619..a71dff2 100644 --- a/patch.Make.go +++ b/patch.Make.go @@ -16,9 +16,9 @@ func (f *Forge) MakeDevelPatchSet() (*Patchs, error) { } defer os.RemoveAll(dir) // clean up - loop := f.Repos.SortByGoPath() - for loop.Scan() { - repo := loop.Next() + all := f.Repos.SortByGoPath() + for all.Scan() { + repo := all.Next() userb := repo.GetUserBranchName() develb := repo.GetDevelBranchName() @@ -47,9 +47,9 @@ func (f *Forge) MakePatchSet() (*Patchs, error) { } defer os.RemoveAll(dir) // clean up - loop := f.Repos.SortByGoPath() - for loop.Scan() { - repo := loop.Next() + all := f.Repos.SortByGoPath() + for all.Scan() { + repo := all.Next() userb := repo.GetUserBranchName() develb := repo.GetDevelBranchName()