maybe someday this will work
This commit is contained in:
parent
6e9ff62fba
commit
0de08f72ef
25
findNext.go
25
findNext.go
|
@ -97,11 +97,12 @@ func findNext() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// tries to fix the go.mod and go.sum files
|
func runGoClean(check *gitpb.Repo) bool {
|
||||||
func fixGodeps(check *gitpb.Repo) bool {
|
|
||||||
var good bool = true
|
|
||||||
// check if the package dependancies changed, if so, re-publish
|
// check if the package dependancies changed, if so, re-publish
|
||||||
|
check.GoDeps = nil
|
||||||
|
|
||||||
cmd := []string{"go-clean", "--auto"}
|
cmd := []string{"go-clean", "--auto"}
|
||||||
|
log.Info("Running", cmd, "in", check.GoPath)
|
||||||
result := check.RunRealtime(cmd)
|
result := check.RunRealtime(cmd)
|
||||||
if result.Error != nil {
|
if result.Error != nil {
|
||||||
log.Info(cmd, "failed with", result.Error, check.GoPath)
|
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)
|
log.Info(cmd, "failed with", result.Exit, check.GoPath)
|
||||||
return false
|
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
|
// skip primative ones
|
||||||
if ok, _ := check.IsPrimitive(); ok {
|
if ok, _ := check.IsPrimitive(); ok {
|
||||||
log.Info("fixGoDeps() skipping primitive", check.GoPath)
|
log.Info("fixGoDeps() skipping primitive", check.GoPath)
|
||||||
return true
|
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())
|
log.Printf("current repo %s go dependancy count: %d", check.GetGoPath(), check.GoDepsLen())
|
||||||
deps := check.GoDeps.SortByGoPath()
|
deps := check.GoDeps.SortByGoPath()
|
||||||
for deps.Scan() {
|
for deps.Scan() {
|
||||||
|
|
|
@ -29,15 +29,31 @@ func makePrepareRelease() {
|
||||||
check.SetTargetVersion(curver)
|
check.SetTargetVersion(curver)
|
||||||
}
|
}
|
||||||
|
|
||||||
// on startup, run fixGoDeps() on every go.sum that didn't match
|
// run go-clean on everything not readonly
|
||||||
if argv.Fix {
|
all = me.forge.Repos.SortByGoPath()
|
||||||
all := me.forge.Repos.SortByGoPath()
|
for all.Scan() {
|
||||||
for all.Scan() {
|
check := all.Next()
|
||||||
check := all.Next()
|
|
||||||
|
|
||||||
if !me.forge.FinalGoDepsCheckOk(check) {
|
if me.forge.Config.IsReadOnly(check.GoPath) {
|
||||||
fixGodeps(check)
|
// 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() {
|
for all.Scan() {
|
||||||
check := all.Next()
|
check := all.Next()
|
||||||
|
|
||||||
|
if me.forge.Config.IsReadOnly(check.GoPath) {
|
||||||
|
// can't release readonly repos
|
||||||
|
continue
|
||||||
|
}
|
||||||
// if master != lastTag, always increment
|
// if master != lastTag, always increment
|
||||||
master := check.GetMasterVersion()
|
master := check.GetMasterVersion()
|
||||||
lastTag := check.GetLastTag()
|
lastTag := check.GetLastTag()
|
||||||
|
|
Loading…
Reference in New Issue