diff --git a/finalGoSumCheck.go b/finalGoSumCheck.go index c627ae4..d10b047 100644 --- a/finalGoSumCheck.go +++ b/finalGoSumCheck.go @@ -1,6 +1,8 @@ package forgepb import ( + "errors" + "fmt" "strings" "go.wit.com/lib/protobuf/gitpb" @@ -16,21 +18,18 @@ import ( // 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) FinalGoDepsCheckOk(check *gitpb.Repo, verbose bool) bool { - var good bool = true +func (f *Forge) FinalGoDepsCheckOk(check *gitpb.Repo, verbose bool) error { if check == nil { - log.Info("boo, check == nil") - return false + return errors.New("FinalGoDepsCheckOk() boo, check == nil") } // parse the go.mod and go.sum files if !check.ParseGoSum() { - log.Info("forge.FinalGoDepsCheckOk() failed") - return false + return fmt.Errorf("forge.ParseGoSum() failed. go.mod & go.sum are broken") } if check.GetGoPrimitive() { - return true + return nil } deps := check.GoDeps.SortByGoPath() @@ -42,12 +41,10 @@ func (f *Forge) FinalGoDepsCheckOk(check *gitpb.Repo, verbose bool) bool { // skip this gopath because it's probably broken forever continue } - log.Info("not found:", depRepo.GetGoPath()) - good = false - continue + return fmt.Errorf("dep not found: %s", depRepo.GetGoPath()) } if depRepo.GetVersion() == found.GetMasterVersion() { - log.Printf("%-48s error ?? %-10s vs %-10s\n", depRepo.GetGoPath(), depRepo.GetVersion(), found.GetMasterVersion()) + // log.Printf("%-48s error ?? %-10s vs %-10s\n", depRepo.GetGoPath(), depRepo.GetVersion(), found.GetMasterVersion()) continue } // log.Info("found dep", depRepo.GetGoPath()) @@ -65,51 +62,48 @@ func (f *Forge) FinalGoDepsCheckOk(check *gitpb.Repo, verbose bool) bool { // skip this gopath because it's probably broken forever continue } else { - log.Printf("%-48s error ?? %-10s vs %-10s\n", depRepo.GetGoPath(), depRepo.GetVersion(), found.GetMasterVersion()) - log.Printf("%-48s error %10s vs %10s\n", depRepo.GetGoPath(), depRepo.GetVersion(), found.GetTargetVersion()) - good = false + // log.Printf("%-48s error ?? %-10s vs %-10s\n", depRepo.GetGoPath(), depRepo.GetVersion(), found.GetMasterVersion()) + // log.Printf("%-48s error %10s vs %10s\n", depRepo.GetGoPath(), depRepo.GetVersion(), found.GetTargetVersion()) + return fmt.Errorf("%-48s error %10s vs %10s", depRepo.GetGoPath(), depRepo.GetVersion(), found.GetMasterVersion()) } } } } - if good { - log.Printf("current repo %s go dependancy count: %d\n", check.GetGoPath(), check.GoDepsLen()) - } - return good + return nil } func (f *Forge) CheckOverride(gopath string) bool { if gopath == "cloud.google.com/go" { - log.Info("CheckOverride() is ignoring", gopath) + // log.Info("CheckOverride() is ignoring", gopath) return true } if gopath == "bou.ke/monkey" { - log.Info("CheckOverride() is ignoring", gopath) + // log.Info("CheckOverride() is ignoring", gopath) return true } if gopath == "github.com/posener/complete/v2" { - log.Info("CheckOverride() is ignoring", gopath) + // log.Info("CheckOverride() is ignoring", gopath) return true } if strings.HasPrefix(gopath, "github.com/go-gl") { - log.Info("CheckOverride() is ignoring", gopath) + // log.Info("CheckOverride() is ignoring", gopath) return true } if strings.HasPrefix(gopath, "google.golang.org") { - log.Info("CheckOverride() is ignoring", gopath) + // log.Info("CheckOverride() is ignoring", gopath) return true } if strings.HasPrefix(gopath, "go.opencensus.io") { - log.Info("CheckOverride() is ignoring", gopath) + // log.Info("CheckOverride() is ignoring", gopath) return true } if strings.HasPrefix(gopath, "github.com/nicksnyder/go-i18n") { - log.Info("CheckOverride() is ignoring", gopath) + // log.Info("CheckOverride() is ignoring", gopath) return true } // fuckit for now. just blacklist github.com if strings.HasPrefix(gopath, "github.com/") { - log.Info("CheckOverride() is ignoring", gopath) + // log.Info("CheckOverride() is ignoring", gopath) return true } return false diff --git a/humanShowRepo.go b/humanShowRepo.go index d55b7c8..c6950ca 100644 --- a/humanShowRepo.go +++ b/humanShowRepo.go @@ -86,7 +86,7 @@ func (f *Forge) testGoRepo(check *gitpb.Repo) { data, _ := os.ReadFile(filepath.Join(check.FullPath, "go.mod")) log.Info(string(data)) - if f.FinalGoDepsCheckOk(check, true) { + if err := f.FinalGoDepsCheckOk(check, true); err == nil { log.Info("forge.FinalGoDepsCheck(check) worked!") } else { log.Info("forge.FinalGoDepsCheck(check) failed. boo.")