Refactoring: use CollectionFactory instead of manual collection creation.

This commit is contained in:
Andrey Smirnov
2014-03-25 14:59:26 +04:00
parent a0497058ee
commit 1a60ac6aa0
24 changed files with 101 additions and 165 deletions
+3 -5
View File
@@ -15,13 +15,11 @@ func aptlyMirrorList(cmd *commander.Command, args []string) error {
return err
}
repoCollection := debian.NewRemoteRepoCollection(context.database)
if repoCollection.Len() > 0 {
if context.collectionFactory.RemoteRepoCollection().Len() > 0 {
fmt.Printf("List of mirrors:\n")
repos := make([]string, repoCollection.Len())
repos := make([]string, context.collectionFactory.RemoteRepoCollection().Len())
i := 0
repoCollection.ForEach(func(repo *debian.RemoteRepo) error {
context.collectionFactory.RemoteRepoCollection().ForEach(func(repo *debian.RemoteRepo) error {
repos[i] = repo.String()
i++
return nil