diff options
Diffstat (limited to 'goDebCheck.go')
| -rw-r--r-- | goDebCheck.go | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/goDebCheck.go b/goDebCheck.go new file mode 100644 index 0000000..65a75e5 --- /dev/null +++ b/goDebCheck.go @@ -0,0 +1,45 @@ +package forgepb + +import ( + "go.wit.com/lib/protobuf/gitpb" + "go.wit.com/log" +) + +// this is a final check to make sure, before pushing +// a golang repo, that the go.sum file has the correct +// and current version of every package +// +// it re-scans the go.sum file. DOES NOT MODIFY ANYTHING +// this is the last thing to run to double check everything +// before 'git tag' or git push --tags +func (f *Forge) FinalGoDepsCheck(check *gitpb.Repo) bool { + var good bool = true + if check == nil { + log.Info("boo, check == nil") + return false + } + // clear out the protobuf and rescan from the file + check.GoDeps = nil + check.ParseGoSum() + + log.Printf("current repo %s go dependancy count: %d", check.GetGoPath(), check.GoDepsLen()) + deps := check.GoDeps.SortByGoPath() + for deps.Scan() { + depRepo := deps.Next() + found := f.Repos.FindByGoPath(depRepo.GetGoPath()) + if found == nil { + log.Info("not found:", depRepo.GetGoPath()) + return false + } + // log.Info("found dep", depRepo.GetGoPath()) + if depRepo.GetVersion() != found.GetMasterVersion() { + if f.IsReadOnly(depRepo.GetGoPath()) { + log.Printf("%-48s ok error %10s vs %10s (ignoring read-only repo)", depRepo.GetGoPath(), depRepo.GetVersion(), found.GetMasterVersion()) + } else { + log.Printf("%-48s error %10s vs %10s", depRepo.GetGoPath(), depRepo.GetVersion(), found.GetMasterVersion()) + good = false + } + } + } + return good +} |
