gitpb/goDep.helpers.go

29 lines
649 B
Go
Raw Permalink Normal View History

2024-11-27 14:27:09 -06:00
package gitpb
// this is becoming a standard format
// todo: autogenerate this from the .proto file?
import (
"time"
)
2024-12-01 00:49:25 -06:00
func (repo *Repo) DeleteGoDepByHash(hash string) {
repo.GoDeps.DeleteByHash(hash)
2024-11-27 14:27:09 -06:00
}
// enforces no duplicate package names
func (repo *Repo) AppendGoDep(newP *GoDep) bool {
return repo.GoDeps.AppendUniqueGoPath(newP)
2024-11-27 14:27:09 -06:00
}
// returns time.Duration since last scan of go.sum & go.mod
func (repo *Repo) AgeGoDep() time.Duration {
2024-12-17 06:37:14 -06:00
t := time.Since(repo.Times.LastGoDep.AsTime())
2024-11-27 14:27:09 -06:00
return t
}
// find a dependancy by the go path
func (repo *Repo) FindGoDepByPath(gopath string) *GoDep {
return repo.GoDeps.FindByGoPath(gopath)
2024-11-27 14:27:09 -06:00
}