attempt hacky fix

This commit is contained in:
Jeff Carr 2024-12-13 20:31:55 -06:00
parent 22c29b3625
commit e90127b54a
2 changed files with 17 additions and 0 deletions

View File

@ -18,6 +18,7 @@ import (
// matches the go.sum file // matches the go.sum file
func cleanGoDepsCheckOk(check *gitpb.Repo) error { func cleanGoDepsCheckOk(check *gitpb.Repo) error {
var err error = nil var err error = nil
var fixes [][]string
log.Printf("current repo %s go dependancy count: %d", check.GetGoPath(), check.GoDepsLen()) log.Printf("current repo %s go dependancy count: %d", check.GetGoPath(), check.GoDepsLen())
all := check.GoDeps.SortByGoPath() all := check.GoDeps.SortByGoPath()
for all.Scan() { for all.Scan() {
@ -60,11 +61,17 @@ func cleanGoDepsCheckOk(check *gitpb.Repo) error {
depRepo.GetVersion(), found.GetMasterVersion(), ends) depRepo.GetVersion(), found.GetMasterVersion(), ends)
errs := fmt.Sprintf("%s error %s vs %s %s", depRepo.GetGoPath(), errs := fmt.Sprintf("%s error %s vs %s %s", depRepo.GetGoPath(),
depRepo.GetVersion(), found.GetMasterVersion(), ends) depRepo.GetVersion(), found.GetMasterVersion(), ends)
cmd := []string{"go", "get", depRepo.GetGoPath() + "@" + found.GetMasterVersion()}
fixes = append(fixes, cmd)
err = errors.New(errs) err = errors.New(errs)
} }
} }
} }
} }
for i, cmd := range fixes {
log.Info("try cmd", i, cmd)
check.RunRealtime(cmd)
}
return err return err
} }

10
main.go
View File

@ -168,12 +168,22 @@ func doMain(repo *gitpb.Repo) error {
} }
if argv.Trim { if argv.Trim {
// the first time, it'll attempt to fix some stuff
cleanGoDepsCheckOk(repo)
// try to trim junk // try to trim junk
if err := trimGoSum(repo); err != nil { if err := trimGoSum(repo); err != nil {
return err return err
} }
repo.ParseGoSum()
} }
/*
data, _ := repo.ReadFile("go.mod")
log.Info(string(data))
data, _ = repo.ReadFile("go.sum")
log.Info(string(data))
*/
// check go.sum file // check go.sum file
if err := cleanGoDepsCheckOk(repo); err != nil { if err := cleanGoDepsCheckOk(repo); err != nil {
log.Info("forge.FinalGoDepsCheck() failed. boo. :", repo.GoPath) log.Info("forge.FinalGoDepsCheck() failed. boo. :", repo.GoPath)