summaryrefslogtreecommitdiff
path: root/goDep.redoGoMod.go
diff options
context:
space:
mode:
Diffstat (limited to 'goDep.redoGoMod.go')
-rw-r--r--goDep.redoGoMod.go42
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
+}