use 'all' instead of 'loop'

This commit is contained in:
Jeff Carr 2024-12-11 19:31:37 -06:00
parent 0235d4d096
commit dae2653975
8 changed files with 53 additions and 53 deletions

View File

@ -48,9 +48,9 @@ func (f *Forge) doBuild(repo *gitpb.Repo, userFlags []string, goWhat string) err
version := repo.GetCurrentBranchVersion() version := repo.GetCurrentBranchVersion()
/* /*
loop := repo.Tags.SortByRefname() all := repo.Tags.SortByRefname()
for loop.Scan() { for all.Scan() {
t := loop.Next() t := all.Next()
log.Info("Build() tag:", t.Refname) 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 // run autogenpb in all protobuf repos
loop1 := repo.GoDeps.SortByGoPath() all := repo.GoDeps.SortByGoPath()
for loop1.Scan() { for all.Scan() {
t := loop1.Next() t := all.Next()
found := f.Repos.FindByGoPath(t.GetGoPath()) found := f.Repos.FindByGoPath(t.GetGoPath())
if found.RepoType() == "protobuf" { if found.RepoType() == "protobuf" {
if err := f.runAutogenpb(found); err != nil { if err := f.runAutogenpb(found); err != nil {

View File

@ -63,9 +63,9 @@ func (f *Forge) CleanGoDepsCheckOk(check *gitpb.Repo) error {
var err error = nil var err error = nil
log.Printf("current repo %s go dependancy count: %d", check.GetGoPath(), check.GoDepsLen()) log.Printf("current repo %s go dependancy count: %d", check.GetGoPath(), check.GoDepsLen())
deps := check.GoDeps.SortByGoPath() all := check.GoDeps.SortByGoPath()
for deps.Scan() { for all.Scan() {
depRepo := deps.Next() depRepo := all.Next()
found := f.Repos.FindByGoPath(depRepo.GetGoPath()) found := f.Repos.FindByGoPath(depRepo.GetGoPath())
if found == nil { if found == nil {
if f.checkOverride(depRepo.GetGoPath()) { if f.checkOverride(depRepo.GetGoPath()) {

View File

@ -37,9 +37,9 @@ func (all *ForgeConfigs) UpdateGoPath(name string, gopath string) bool {
func (fc *ForgeConfigs) IsReadOnly(gopath string) bool { func (fc *ForgeConfigs) IsReadOnly(gopath string) bool {
var match *ForgeConfig var match *ForgeConfig
loop := fc.SortByGoPath() // get the list of repos all := fc.SortByGoPath() // get the list of repos
for loop.Scan() { for all.Scan() {
r := loop.Next() r := all.Next()
if r.GoPath == gopath { if r.GoPath == gopath {
// exact gopath match // exact gopath match
if r.Writable { if r.Writable {
@ -98,9 +98,9 @@ func (fc *ForgeConfigs) DebName(gopath string) string {
// get "zookeeper" from "go.wit.com/apps/zookeeper" // get "zookeeper" from "go.wit.com/apps/zookeeper"
normalBase := filepath.Base(gopath) normalBase := filepath.Base(gopath)
loop := fc.SortByGoPath() all := fc.SortByGoPath()
for loop.Scan() { for all.Scan() {
r := loop.Next() r := all.Next()
if r.GoPath == gopath { if r.GoPath == gopath {
// returns "zookeeper-go" for "go.wit.com/apps/zookeeper" // returns "zookeeper-go" for "go.wit.com/apps/zookeeper"
if r.DebName != "" { if r.DebName != "" {
@ -127,9 +127,9 @@ func (fc *ForgeConfigs) IsPrivate(thing string) bool {
// sort by path means the simple 'match' logic // sort by path means the simple 'match' logic
// here works in the sense the last directory match // here works in the sense the last directory match
// is the one that is used // is the one that is used
loop := fc.SortByGoPath() // get the list of repos all := fc.SortByGoPath() // get the list of repos
for loop.Scan() { for all.Scan() {
r := loop.Next() r := all.Next()
if r.GoPath == thing { if r.GoPath == thing {
// if private is set here, then ok, otherwise // if private is set here, then ok, otherwise
// still check if a Directory match exists // 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 { func (fc *ForgeConfigs) IsFavorite(thing string) bool {
var match *ForgeConfig var match *ForgeConfig
loop := fc.SortByGoPath() // get the list of repos all := fc.SortByGoPath() // get the list of repos
for loop.Scan() { for all.Scan() {
r := loop.Next() r := all.Next()
if r.GoPath == thing { if r.GoPath == thing {
if r.Favorite { if r.Favorite {
return true return true
@ -201,9 +201,9 @@ func (fc *ForgeConfigs) IsFavorite(thing string) bool {
func (fc *ForgeConfigs) IsWritable(thing string) bool { func (fc *ForgeConfigs) IsWritable(thing string) bool {
var match *ForgeConfig var match *ForgeConfig
loop := fc.SortByGoPath() // get the list of repos all := fc.SortByGoPath() // get the list of repos
for loop.Scan() { for all.Scan() {
r := loop.Next() r := all.Next()
if r.GoPath == thing { if r.GoPath == thing {
if r.Writable { if r.Writable {
return true return true

View File

@ -13,8 +13,8 @@ func (f *Forge) GitPull() bool {
log.Log(FORGEPBWARN, "running git pull everywhere") log.Log(FORGEPBWARN, "running git pull everywhere")
var failed int = 0 var failed int = 0
for loop.Scan() { for all.Scan() {
repo := loop.Next() repo := all.Next()
if out, err := repo.GitPull(); err == nil { if out, err := repo.GitPull(); err == nil {
log.Log(FORGEPBWARN, "Ran git pull ok", repo.GetGoPath(), out) log.Log(FORGEPBWARN, "Ran git pull ok", repo.GetGoPath(), out)
} else { } else {
@ -41,9 +41,9 @@ func (f *Forge) CheckoutDevel() bool {
log.Log(FORGEPBWARN, "running git checkout devel everwhere") log.Log(FORGEPBWARN, "running git checkout devel everwhere")
var failed int = 0 var failed int = 0
var count int = 0 var count int = 0
loop := f.Repos.SortByGoPath() all := f.Repos.SortByGoPath()
for loop.Scan() { for all.Scan() {
repo := loop.Next() repo := all.Next()
count += 1 count += 1
if repo.CheckoutDevel() { if repo.CheckoutDevel() {
// checkout ok // checkout ok
@ -59,9 +59,9 @@ func (f *Forge) CheckoutMaster() bool {
log.Log(FORGEPBWARN, "running git checkout master everwhere") log.Log(FORGEPBWARN, "running git checkout master everwhere")
var failed int = 0 var failed int = 0
var count int = 0 var count int = 0
loop := f.Repos.SortByGoPath() all := f.Repos.SortByGoPath()
for loop.Scan() { for all.Scan() {
repo := loop.Next() repo := all.Next()
count += 1 count += 1
if repo.CheckoutMaster() { if repo.CheckoutMaster() {
// checkout ok // checkout ok
@ -77,9 +77,9 @@ func (f *Forge) CheckoutUser() bool {
log.Log(FORGEPBWARN, "running git checkout master everwhere") log.Log(FORGEPBWARN, "running git checkout master everwhere")
var failed int = 0 var failed int = 0
var count int = 0 var count int = 0
loop := f.Repos.SortByGoPath() all := f.Repos.SortByGoPath()
for loop.Scan() { for all.Scan() {
repo := loop.Next() repo := all.Next()
count += 1 count += 1
if repo.CheckoutUser() { if repo.CheckoutUser() {
// checkout ok // checkout ok

View File

@ -133,9 +133,9 @@ func (f *Forge) rillScanDirs(gopaths []string) (int, error) {
func (f *Forge) RillRedoGoMod() int { func (f *Forge) RillRedoGoMod() int {
var all []*gitpb.Repo var all []*gitpb.Repo
repos := f.Repos.SortByGoPath() tmp := f.Repos.SortByGoPath()
for repos.Scan() { for tmp.Scan() {
repo := repos.Next() repo := tmp.Next()
if !repo.IsValid() { if !repo.IsValid() {
log.Printf("%10s %-50s", "old?", repo.GetGoPath()) log.Printf("%10s %-50s", "old?", repo.GetGoPath())
continue continue

View File

@ -27,9 +27,9 @@ func (f *Forge) MakeGoWork() error {
fmt.Fprintln(workf, "") fmt.Fprintln(workf, "")
fmt.Fprintln(workf, "use (") fmt.Fprintln(workf, "use (")
loop := f.Repos.SortByGoPath() all := f.Repos.SortByGoPath()
for loop.Scan() { for all.Scan() {
repo := loop.Next() repo := all.Next()
/* /*
if !repo.IsGoLang() == "" { if !repo.IsGoLang() == "" {
// skip repos that aren't go // skip repos that aren't go

View File

@ -43,17 +43,17 @@ func (f *Forge) ConfigPrintTable() {
return return
} }
log.Info(standardHeader()) log.Info(standardHeader())
loop := f.Config.SortByGoPath() all := f.Config.SortByGoPath()
for loop.Scan() { for all.Scan() {
r := loop.Next() r := all.Next()
log.Info(f.standardHeader(r)) log.Info(f.standardHeader(r))
} }
} }
func (f *Forge) newestAge(repo *gitpb.Repo) time.Duration { func (f *Forge) newestAge(repo *gitpb.Repo) time.Duration {
loop := repo.Tags.SortByAge() all := repo.Tags.SortByAge()
for loop.Scan() { for all.Scan() {
r := loop.Next() r := all.Next()
return time.Since(r.GetAuthordate().AsTime()) return time.Since(r.GetAuthordate().AsTime())
} }
return time.Since(time.Now()) return time.Since(time.Now())

View File

@ -16,9 +16,9 @@ func (f *Forge) MakeDevelPatchSet() (*Patchs, error) {
} }
defer os.RemoveAll(dir) // clean up defer os.RemoveAll(dir) // clean up
loop := f.Repos.SortByGoPath() all := f.Repos.SortByGoPath()
for loop.Scan() { for all.Scan() {
repo := loop.Next() repo := all.Next()
userb := repo.GetUserBranchName() userb := repo.GetUserBranchName()
develb := repo.GetDevelBranchName() develb := repo.GetDevelBranchName()
@ -47,9 +47,9 @@ func (f *Forge) MakePatchSet() (*Patchs, error) {
} }
defer os.RemoveAll(dir) // clean up defer os.RemoveAll(dir) // clean up
loop := f.Repos.SortByGoPath() all := f.Repos.SortByGoPath()
for loop.Scan() { for all.Scan() {
repo := loop.Next() repo := all.Next()
userb := repo.GetUserBranchName() userb := repo.GetUserBranchName()
develb := repo.GetDevelBranchName() develb := repo.GetDevelBranchName()