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()
/*
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 {

View File

@ -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()) {

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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())

View File

@ -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()