diff options
Diffstat (limited to 'repos.sort.go')
| -rw-r--r-- | repos.sort.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/repos.sort.go b/repos.sort.go index b4656e6..8bde45a 100644 --- a/repos.sort.go +++ b/repos.sort.go @@ -35,7 +35,7 @@ func (it *RepoIterator) Scan() bool { } // Repo returns the current repo. -func (it *RepoIterator) Repo() *Repo { +func (it *RepoIterator) Next() *Repo { if it.packs[it.index-1] == nil { for i, d := range it.packs { fmt.Println("i =", i, d) @@ -61,10 +61,10 @@ func (r *Repos) All() *RepoIterator { return iterator } -func (r *Repos) SortByName() *RepoIterator { +func (r *Repos) SortByPath() *RepoIterator { packs := r.selectAllRepo() - sort.Sort(RepoByName(packs)) + sort.Sort(RepoByPath(packs)) iterator := NewRepoIterator(packs) return iterator @@ -77,11 +77,11 @@ func (all *Repos) Len() int { return len(all.Repos) } -type RepoByName []*Repo +type RepoByPath []*Repo -func (a RepoByName) Len() int { return len(a) } -func (a RepoByName) Less(i, j int) bool { return a[i].GoPath < a[j].GoPath } -func (a RepoByName) Swap(i, j int) { a[i], a[j] = a[j], a[i] } +func (a RepoByPath) Len() int { return len(a) } +func (a RepoByPath) Less(i, j int) bool { return a[i].GoPath < a[j].GoPath } +func (a RepoByPath) Swap(i, j int) { a[i], a[j] = a[j], a[i] } // safely returns a slice of pointers to the Repo protobufs func (all *Repos) selectAllRepo() []*Repo { |
