From 1eeab586708e3535eadea6e7995a957988555dbf Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sun, 31 Aug 2025 16:24:37 -0500 Subject: [PATCH] fix output formatting errors --- cleanGoSum.go | 6 +++--- doStrict.go | 39 ++++++++++++++++++++++++++------------- 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/cleanGoSum.go b/cleanGoSum.go index 00e8046..8909f38 100644 --- a/cleanGoSum.go +++ b/cleanGoSum.go @@ -50,20 +50,20 @@ func cleanGoDepsCheckOk(check *gitpb.Repo) error { if forge.Config.IsReadOnly(check.GetGoPath()) { ends += "(ignoring read-only) " if argv.Verbose { - log.Printf("%-48s ok error .%s. vs .%s. %s", depRepo.GetGoPath(), + log.Printf("%-48s ok error .%s. vs .%s. %s\n", depRepo.GetGoPath(), depRepo.GetVersion(), found.GetMasterVersion(), ends) } } else { if forge.CheckOverride(depRepo.GetGoPath()) { ends += "(override) " if argv.Verbose { - log.Printf("%-48s ok error .%s. vs .%s. %s", depRepo.GetGoPath(), + log.Printf("%-48s ok error .%s. vs .%s. %s\n", depRepo.GetGoPath(), depRepo.GetVersion(), found.GetMasterVersion(), ends) // skip this gopath because it's probably broken forever } continue } else { - log.Printf("%-48s error %10s vs %10s %s", depRepo.GetGoPath(), + log.Printf("%-48s error %10s vs %10s %s\n", depRepo.GetGoPath(), depRepo.GetVersion(), found.GetMasterVersion(), ends) errs := fmt.Sprintf("%s error %s vs %s %s", depRepo.GetGoPath(), depRepo.GetVersion(), found.GetMasterVersion(), ends) diff --git a/doStrict.go b/doStrict.go index a1d1f28..8e49b8f 100644 --- a/doStrict.go +++ b/doStrict.go @@ -38,8 +38,8 @@ func doStrict(repo *gitpb.Repo) error { return errors.New(repo.GetGoPath() + " not in the git master branch") } - err = repo.RepoIgnoresGoMod() - if err != nil { + // not sure if this really needs to be run a second time. probably not, but whatever. who cares + if err := repo.RepoIgnoresGoMod(); err != nil { log.Info(repo.GetGoPath(), "some wierd git error happened. investigate.", err) return err } @@ -91,14 +91,16 @@ func doStrict(repo *gitpb.Repo) error { } // the first time, it'll attempt to fix some stuff - log.Info("Running: updateToNewestReleases()") + log.Info(repo.GetGoPath(), "Running: updateToNewestReleases()") cleanGoDepsCheckOk(repo) - // try to trim junk - log.Info("Running: trimGoSum()") - if err := trimGoSum(repo); err != nil { - log.Info(repo.GetGoPath(), "trimGoSum() failed", err) - return err + if repo.Exists("go.sum") { + // try to trim junk + log.Info(repo.GetGoPath(), "Running: trimGoSum()") + if err := trimGoSum(repo); err != nil { + log.Info(repo.GetGoPath(), "trimGoSum() failed", err) + return err + } } if repo.ParseGoSum() { @@ -107,17 +109,28 @@ func doStrict(repo *gitpb.Repo) error { log.Info(repo.GetGoPath(), "ParseGoSum() failed") } - // check go.sum file - if err := cleanGoDepsCheckOk(repo); err != nil { - log.Info("forge.FinalGoDepsCheck() failed. boo. :", repo.GetGoPath()) - return err + if !repo.GetGoPrimitive() { + // check go.sum file + if err := cleanGoDepsCheckOk(repo); err != nil { + log.Info(repo.GetGoPath(), "forge.FinalGoDepsCheck() failed. boo.") + return err + } + } + + if repo.Exists("go.sum") { + // try to trim junk + log.Info(repo.GetGoPath(), "Running: trimGoSum()") + if err := trimGoSum(repo); err != nil { + log.Info(repo.GetGoPath(), "trimGoSum() failed", err) + return err + } } // put the files in the notes section in git // this way, git commits are not messed up // with this autogenerated code if err := saveAsMetadata(repo); err != nil { - log.Info("save go.mod as git metadata failed", repo.GetGoPath(), err) + log.Info(repo.GetGoPath(), "save go.mod as git metadata failed", err) return err }