quiet lots of debugging output

This commit is contained in:
Jeff Carr 2025-01-29 20:00:49 -06:00
parent d9d90e9e12
commit f146bf4ef0
2 changed files with 21 additions and 27 deletions

View File

@ -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

View File

@ -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.")