From 4a79cccffd6cd20e42271eada567c4b8c0edc2f4 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 29 Nov 2024 18:15:25 -0600 Subject: attempt to use go.wit.com/apps/autogenpb for sort --- godep.helpers.go | 57 -------------------------------------------------------- 1 file changed, 57 deletions(-) delete mode 100644 godep.helpers.go (limited to 'godep.helpers.go') diff --git a/godep.helpers.go b/godep.helpers.go deleted file mode 100644 index 007cc61..0000000 --- a/godep.helpers.go +++ /dev/null @@ -1,57 +0,0 @@ -package gitpb - -// this is becoming a standard format -// todo: autogenerate this from the .proto file? - -import ( - "time" -) - -func (repo *Repo) DeleteGoDepByHash(hash string) *GoDep { - refslock.Lock() - defer refslock.Unlock() - - for i, _ := range repo.GoDeps { - if repo.GoDeps[i].Hash == hash { - repo.GoDeps[i] = repo.GoDeps[len(repo.GoDeps)-1] - repo.GoDeps = repo.GoDeps[:len(repo.GoDeps)-1] - return nil - } - } - return nil -} - -// enforces no duplicate package names -func (repo *Repo) AppendGoDep(newP *GoDep) bool { - refslock.Lock() - defer refslock.Unlock() - - for _, p := range repo.GoDeps { - if p.GoPath == newP.GoPath { - return false - } - } - - repo.GoDeps = append(repo.GoDeps, newP) - return true -} - -// returns time.Duration since last scan of go.sum & go.mod -func (repo *Repo) AgeGoDep() time.Duration { - t := time.Since(repo.LastGoDep.AsTime()) - return t -} - -// find a dependancy by the go path -func (repo *Repo) FindGoDepByPath(gopath string) *GoDep { - refslock.RLock() - defer refslock.RUnlock() - - for _, p := range repo.GoDeps { - if p.GoPath == gopath { - return p - } - } - - return nil -} -- cgit v1.2.3