diff options
| author | Jeff Carr <[email protected]> | 2024-12-01 15:10:55 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-12-01 15:10:55 -0600 |
| commit | 82935ae6b2d413322b18a9b487973e5ab04e6efd (patch) | |
| tree | 347ae7e15eea4c5186cfe4c307be67d488a533dd /goDep.redoGoMod.go | |
| parent | fd3b806b4a1f647103c7ecb417cf1ffced9c4cb1 (diff) | |
attempt to detect new package dependancy versionsv0.0.14
Diffstat (limited to 'goDep.redoGoMod.go')
| -rw-r--r-- | goDep.redoGoMod.go | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/goDep.redoGoMod.go b/goDep.redoGoMod.go index db64a1e..72249fe 100644 --- a/goDep.redoGoMod.go +++ b/goDep.redoGoMod.go @@ -202,3 +202,45 @@ func (repo *Repo) UpdatePublished() (bool, error) { } return true, nil } + +// returns true if the last published +func (repo *Repo) GoDepsLen() int { + if repo.GoDeps == nil { + return 0 + } + return repo.GoDeps.Len() +} + +// returns true if the last published +func (repo *Repo) PublishedLen() int { + if repo.Published == nil { + return 0 + } + return repo.Published.Len() +} + +// returns true if the last published +func (all *Repos) GoDepsChanged(repo *Repo) (bool, error) { + var match bool = true + + if repo.GoDeps == nil { + repo.RedoGoMod() + } + if repo.GoDeps.Len() == 0 { + repo.RedoGoMod() + } + log.Printf("current repo %s go dependancy count: %d", repo.GetGoPath(), repo.GoDeps.Len()) + deps := repo.GoDeps.SortByGoPath() + for deps.Scan() { + depRepo := deps.Next() + if repo.Published == nil { + return false, errors.New("repo published deps info is nil") + } + found := repo.Published.FindByGoPath(depRepo.GetGoPath()) + if found == nil { + return true, errors.New("new repo added " + depRepo.GetGoPath()) + } + log.Printf("deps %-50s %-10s vs %-10s", depRepo.GetGoPath(), depRepo.GetVersion(), found.GetVersion()) + } + return match, nil +} |
