diff options
Diffstat (limited to 'find.go')
| -rw-r--r-- | find.go | 36 |
1 files changed, 10 insertions, 26 deletions
@@ -54,10 +54,7 @@ func (f *FindCmd) findRepos() *gitpb.Repos { } func findPrivate() { - all := me.forge.Repos.SortByFullPath() - for all.Scan() { - repo := all.Next() - + for repo := range me.forge.Repos.IterByFullPath() { if me.forge.Config.IsPrivate(repo.GetGoPath()) { me.found.AppendByGoPath(repo) } @@ -67,9 +64,8 @@ func findPrivate() { // finds repos that are writable func findMine() { // log.Printf("get mine %s\n", me.forge.GetGoSrc()) - all := me.forge.Repos.SortByFullPath() - for all.Scan() { - repo := all.Next() + for repo := range me.forge.Repos.IterByFullPath() { + if me.forge.Config.IsWritable(repo.GetGoPath()) { me.found.AppendByGoPath(repo) } @@ -79,9 +75,8 @@ func findMine() { // finds repos the user has marked as favorites in the forge .config func findFavorites() { // log.Printf("get favorites %s\n", me.forge.GetGoSrc()) - all := me.forge.Repos.SortByFullPath() - for all.Scan() { - repo := all.Next() + for repo := range me.forge.Repos.IterByFullPath() { + if me.forge.Config.IsFavorite(repo.GetGoPath()) { me.found.AppendByGoPath(repo) } @@ -91,10 +86,7 @@ func findFavorites() { // finds repos that git is reporting as dirty func findDirty() *gitpb.Repos { found := gitpb.NewRepos() - all := me.forge.Repos.SortByFullPath() - for all.Scan() { - var repo *gitpb.Repo - repo = all.Next() + for repo := range me.forge.Repos.IterByFullPath() { if repo.IsDirty() { found.AppendByGoPath(repo) } @@ -103,17 +95,13 @@ func findDirty() *gitpb.Repos { } func findAll() { - all := me.forge.Repos.SortByFullPath() - for all.Scan() { - repo := all.Next() + for repo := range me.forge.Repos.IterByFullPath() { me.found.AppendByGoPath(repo) } } func findUser() { - all := me.forge.Repos.SortByFullPath() - for all.Scan() { - repo := all.Next() + for repo := range me.forge.Repos.IterByFullPath() { if repo.GetCurrentBranchName() == repo.GetUserBranchName() { me.found.AppendByGoPath(repo) } @@ -121,9 +109,7 @@ func findUser() { } func findPublishable() { - all := me.forge.Repos.SortByFullPath() - for all.Scan() { - repo := all.Next() + for repo := range me.forge.Repos.IterByFullPath() { if repo.GetTargetVersion() == "" { continue } @@ -132,9 +118,7 @@ func findPublishable() { } func findReposWithPatches() { - all := me.forge.Repos.SortByFullPath() - for all.Scan() { - repo := all.Next() + for repo := range me.forge.Repos.IterByFullPath() { if repo.GetTargetVersion() != "" { // add everything that has a target version set me.found.AppendByGoPath(repo) |
