summaryrefslogtreecommitdiff
path: root/repos.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-11-20 21:22:05 -0600
committerJeff Carr <[email protected]>2024-11-20 21:22:05 -0600
commitce06800c41750f901c43cb35bcf9df8863dc3686 (patch)
treeba6fc30078dd4c91d0dd514a83b47ede29fb096e /repos.go
parent704d06ba87ac8bc4af4abc1ed88efed82df7127d (diff)
boo. was wrong. had to redo a lot
Diffstat (limited to 'repos.go')
-rw-r--r--repos.go26
1 files changed, 13 insertions, 13 deletions
diff --git a/repos.go b/repos.go
index 4222ab9..5340e62 100644
--- a/repos.go
+++ b/repos.go
@@ -61,22 +61,22 @@ func (r *Repos) All() *RepoIterator {
return iterator
}
-func (r *Repos) SortByName() *RepoIterator {
+func (r *Repos) SortByPath() *RepoIterator {
packs := r.selectAllRepos()
- sort.Sort(ByRepoName(packs))
+ sort.Sort(ByRepoPath(packs))
iterator := NewRepoIterator(packs)
return iterator
}
-// enforces no duplicate repo names
+// enforces no duplicate repo paths
func (r *Repos) Append(newP *Repo) bool {
reposLock.Lock()
defer reposLock.Unlock()
for _, p := range r.Repos {
- if p.Name == newP.Name {
+ if p.GoPath == newP.GoPath {
return false
}
}
@@ -91,13 +91,13 @@ func (r *Repo) Age(newP *Repo) time.Duration {
return t
}
-// find a repo by name
-func (r *Repos) FindByName(name string) *Repo {
+// find a repo by path
+func (r *Repos) FindByPath(gopath string) *Repo {
reposLock.RLock()
defer reposLock.RUnlock()
for _, p := range r.Repos {
- if p.Name == name {
+ if p.GoPath == gopath {
return p
}
}
@@ -112,20 +112,20 @@ func (r *Repos) Len() int {
return len(r.Repos)
}
-type ByRepoName []*Repo
+type ByRepoPath []*Repo
-func (a ByRepoName) Len() int { return len(a) }
-func (a ByRepoName) Less(i, j int) bool { return a[i].Name < a[j].Name }
-func (a ByRepoName) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
+func (a ByRepoPath) Len() int { return len(a) }
+func (a ByRepoPath) Less(i, j int) bool { return a[i].GoPath < a[j].GoPath }
+func (a ByRepoPath) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
-func (all *Repos) DeleteByName(name string) *Repo {
+func (all *Repos) DeleteByPath(gopath string) *Repo {
reposLock.Lock()
defer reposLock.Unlock()
var newr Repo
for i, _ := range all.Repos {
- if all.Repos[i].Name == name {
+ if all.Repos[i].GoPath == gopath {
newr = *all.Repos[i]
all.Repos[i] = all.Repos[len(all.Repos)-1]
all.Repos = all.Repos[:len(all.Repos)-1]