summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--findNext.go25
-rw-r--r--prepareRelease.go36
2 files changed, 45 insertions, 16 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() {
diff --git a/prepareRelease.go b/prepareRelease.go
index a50a8d7..26ce6da 100644
--- a/prepareRelease.go
+++ b/prepareRelease.go
@@ -29,15 +29,31 @@ func makePrepareRelease() {
check.SetTargetVersion(curver)
}
- // on startup, run fixGoDeps() on every go.sum that didn't match
- if argv.Fix {
- all := me.forge.Repos.SortByGoPath()
- for all.Scan() {
- check := all.Next()
+ // run go-clean on everything not readonly
+ all = me.forge.Repos.SortByGoPath()
+ for all.Scan() {
+ check := all.Next()
- if !me.forge.FinalGoDepsCheckOk(check) {
- fixGodeps(check)
- }
+ if me.forge.Config.IsReadOnly(check.GoPath) {
+ // can't release readonly repos
+ continue
+ }
+
+ if ok, err := check.IsPrimitive(); !ok {
+ log.Info("something wrong with", check.GoPath, err)
+ // no go.sum file for these
+ continue
+ }
+
+ if check.Exists("go.sum") {
+ // probably already ran
+ continue
+ }
+
+ if !runGoClean(check) {
+ log.Info("go-clean FAILED. THIS IS BAD.", check.GoPath)
+ log.Info("go-clean FAILED. THIS IS BAD.", check.GoPath)
+ log.Info("go-clean FAILED. THIS IS BAD.", check.GoPath)
}
}
@@ -45,6 +61,10 @@ func makePrepareRelease() {
for all.Scan() {
check := all.Next()
+ if me.forge.Config.IsReadOnly(check.GoPath) {
+ // can't release readonly repos
+ continue
+ }
// if master != lastTag, always increment
master := check.GetMasterVersion()
lastTag := check.GetLastTag()