From c87e162518f0a2ab472413f638b0cf30fee2409f Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 27 Nov 2024 14:44:51 -0600 Subject: [PATCH] more restructure Signed-off-by: Jeff Carr --- repo.helpers.go | 18 ++++++++++++++++++ repo.sort.go | 14 -------------- 2 files changed, 18 insertions(+), 14 deletions(-) create mode 100644 repo.helpers.go diff --git a/repo.helpers.go b/repo.helpers.go new file mode 100644 index 0000000..f23393c --- /dev/null +++ b/repo.helpers.go @@ -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 +} diff --git a/repo.sort.go b/repo.sort.go index 6495676..28b0f91 100644 --- a/repo.sort.go +++ b/repo.sort.go @@ -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 -}