summaryrefslogtreecommitdiff
path: root/goDebCheck.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-12-02 05:14:52 -0600
committerJeff Carr <[email protected]>2024-12-02 05:14:52 -0600
commitf5d41d782af2c8f04971f88d98d4b641997ae870 (patch)
tree1187c09533787242681c91da79b10efc001f8d2b /goDebCheck.go
parentbe026e8edc5a9cac0d8923cc00099c150f97e329 (diff)
went from 160k os.Stat to 90 on my box. duh
Diffstat (limited to 'goDebCheck.go')
-rw-r--r--goDebCheck.go45
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
+}