more restructure

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-11-27 14:44:51 -06:00
parent c51b8c96b1
commit c87e162518
2 changed files with 18 additions and 14 deletions

18
repo.helpers.go Normal file
View File

@ -0,0 +1,18 @@
package gitpb
// this is becoming a standard format
// todo: autogenerate this from the .proto file?
func (all *Repos) DeleteByPath(gopath string) *Repo {
repolock.Lock()
defer repolock.Unlock()
for i, _ := range all.Repos {
if all.Repos[i].GoPath == gopath {
all.Repos[i] = all.Repos[len(all.Repos)-1]
all.Repos = all.Repos[:len(all.Repos)-1]
return nil
}
}
return nil
}

View File

@ -134,17 +134,3 @@ func (all *Repos) selectAllRepo() []*Repo {
return aRepos
}
func (all *Repos) DeleteByPath(gopath string) *Repo {
repolock.Lock()
defer repolock.Unlock()
for i, _ := range all.Repos {
if all.Repos[i].GoPath == gopath {
all.Repos[i] = all.Repos[len(all.Repos)-1]
all.Repos = all.Repos[:len(all.Repos)-1]
return nil
}
}
return nil
}