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 package forgepb
import ( import (
"errors"
"fmt"
"strings" "strings"
"go.wit.com/lib/protobuf/gitpb" "go.wit.com/lib/protobuf/gitpb"
@ -16,21 +18,18 @@ import (
// it re-scans the go.sum file. DOES NOT MODIFY ANYTHING // it re-scans the go.sum file. DOES NOT MODIFY ANYTHING
// this is the last thing to run to double check everything // this is the last thing to run to double check everything
// before 'git tag' or git push --tags // before 'git tag' or git push --tags
func (f *Forge) FinalGoDepsCheckOk(check *gitpb.Repo, verbose bool) bool { func (f *Forge) FinalGoDepsCheckOk(check *gitpb.Repo, verbose bool) error {
var good bool = true
if check == nil { if check == nil {
log.Info("boo, check == nil") return errors.New("FinalGoDepsCheckOk() boo, check == nil")
return false
} }
// parse the go.mod and go.sum files // parse the go.mod and go.sum files
if !check.ParseGoSum() { if !check.ParseGoSum() {
log.Info("forge.FinalGoDepsCheckOk() failed") return fmt.Errorf("forge.ParseGoSum() failed. go.mod & go.sum are broken")
return false
} }
if check.GetGoPrimitive() { if check.GetGoPrimitive() {
return true return nil
} }
deps := check.GoDeps.SortByGoPath() 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 // skip this gopath because it's probably broken forever
continue continue
} }
log.Info("not found:", depRepo.GetGoPath()) return fmt.Errorf("dep not found: %s", depRepo.GetGoPath())
good = false
continue
} }
if depRepo.GetVersion() == found.GetMasterVersion() { 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 continue
} }
// log.Info("found dep", depRepo.GetGoPath()) // 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 // skip this gopath because it's probably broken forever
continue continue
} else { } 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.GetMasterVersion())
log.Printf("%-48s error %10s vs %10s\n", depRepo.GetGoPath(), depRepo.GetVersion(), found.GetTargetVersion()) // log.Printf("%-48s error %10s vs %10s\n", depRepo.GetGoPath(), depRepo.GetVersion(), found.GetTargetVersion())
good = false return fmt.Errorf("%-48s error %10s vs %10s", depRepo.GetGoPath(), depRepo.GetVersion(), found.GetMasterVersion())
} }
} }
} }
} }
if good { return nil
log.Printf("current repo %s go dependancy count: %d\n", check.GetGoPath(), check.GoDepsLen())
}
return good
} }
func (f *Forge) CheckOverride(gopath string) bool { func (f *Forge) CheckOverride(gopath string) bool {
if gopath == "cloud.google.com/go" { if gopath == "cloud.google.com/go" {
log.Info("CheckOverride() is ignoring", gopath) // log.Info("CheckOverride() is ignoring", gopath)
return true return true
} }
if gopath == "bou.ke/monkey" { if gopath == "bou.ke/monkey" {
log.Info("CheckOverride() is ignoring", gopath) // log.Info("CheckOverride() is ignoring", gopath)
return true return true
} }
if gopath == "github.com/posener/complete/v2" { if gopath == "github.com/posener/complete/v2" {
log.Info("CheckOverride() is ignoring", gopath) // log.Info("CheckOverride() is ignoring", gopath)
return true return true
} }
if strings.HasPrefix(gopath, "github.com/go-gl") { if strings.HasPrefix(gopath, "github.com/go-gl") {
log.Info("CheckOverride() is ignoring", gopath) // log.Info("CheckOverride() is ignoring", gopath)
return true return true
} }
if strings.HasPrefix(gopath, "google.golang.org") { if strings.HasPrefix(gopath, "google.golang.org") {
log.Info("CheckOverride() is ignoring", gopath) // log.Info("CheckOverride() is ignoring", gopath)
return true return true
} }
if strings.HasPrefix(gopath, "go.opencensus.io") { if strings.HasPrefix(gopath, "go.opencensus.io") {
log.Info("CheckOverride() is ignoring", gopath) // log.Info("CheckOverride() is ignoring", gopath)
return true return true
} }
if strings.HasPrefix(gopath, "github.com/nicksnyder/go-i18n") { if strings.HasPrefix(gopath, "github.com/nicksnyder/go-i18n") {
log.Info("CheckOverride() is ignoring", gopath) // log.Info("CheckOverride() is ignoring", gopath)
return true return true
} }
// fuckit for now. just blacklist github.com // fuckit for now. just blacklist github.com
if strings.HasPrefix(gopath, "github.com/") { if strings.HasPrefix(gopath, "github.com/") {
log.Info("CheckOverride() is ignoring", gopath) // log.Info("CheckOverride() is ignoring", gopath)
return true return true
} }
return false return false

View File

@ -86,7 +86,7 @@ func (f *Forge) testGoRepo(check *gitpb.Repo) {
data, _ := os.ReadFile(filepath.Join(check.FullPath, "go.mod")) data, _ := os.ReadFile(filepath.Join(check.FullPath, "go.mod"))
log.Info(string(data)) log.Info(string(data))
if f.FinalGoDepsCheckOk(check, true) { if err := f.FinalGoDepsCheckOk(check, true); err == nil {
log.Info("forge.FinalGoDepsCheck(check) worked!") log.Info("forge.FinalGoDepsCheck(check) worked!")
} else { } else {
log.Info("forge.FinalGoDepsCheck(check) failed. boo.") log.Info("forge.FinalGoDepsCheck(check) failed. boo.")