diff options
Diffstat (limited to 'findNext.go')
| -rw-r--r-- | findNext.go | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/findNext.go b/findNext.go index e78aeb3..a17364c 100644 --- a/findNext.go +++ b/findNext.go @@ -97,11 +97,12 @@ func findNext() bool { return false } -// tries to fix the go.mod and go.sum files -func fixGodeps(check *gitpb.Repo) bool { - var good bool = true +func runGoClean(check *gitpb.Repo) bool { // check if the package dependancies changed, if so, re-publish + check.GoDeps = nil + cmd := []string{"go-clean", "--auto"} + log.Info("Running", cmd, "in", check.GoPath) result := check.RunRealtime(cmd) if result.Error != nil { log.Info(cmd, "failed with", result.Error, check.GoPath) @@ -111,16 +112,24 @@ func fixGodeps(check *gitpb.Repo) bool { log.Info(cmd, "failed with", result.Exit, check.GoPath) return false } - check.GoDeps = nil + if ok, err := check.ParseGoSum(); !ok { + log.Info("ParseGoSum() failed", err) + return false + } + return true +} + +// tries to fix the go.mod and go.sum files +func fixGodeps(check *gitpb.Repo) bool { + var good bool = true + if !runGoClean(check) { + return false + } // skip primative ones if ok, _ := check.IsPrimitive(); ok { log.Info("fixGoDeps() skipping primitive", check.GoPath) return true } - if ok, err := check.ParseGoSum(); !ok { - log.Info("ParseGoSum() failed", err) - return false - } log.Printf("current repo %s go dependancy count: %d", check.GetGoPath(), check.GoDepsLen()) deps := check.GoDeps.SortByGoPath() for deps.Scan() { |
