guireleaser/scanGoSum.go

76 lines
2.0 KiB
Go

// This is a simple example
package main
import (
"go.wit.com/lib/gui/repolist"
"go.wit.com/log"
)
func checkSafeGoSumRemake(r *repolist.Repo) {
if ok, bad := r.Status.CheckSafeGoSumRemake(); ok {
log.Info("checkSafeGoSumRemake() is safe to redo")
r.SetGoState("SAFE")
r.Status.MakeRedomod()
} else {
log.Info("checkSafeGoSumRemake() is not safe. problems:", bad)
r.SetGoState("BAD DEP")
}
}
func scanGoSum() {
for _, repo := range me.repos.View.AllRepos() {
if repo.GoPath() == "go.wit.com/apps/guireleaser" {
if release.guireleaser == nil {
release.guireleaser = repo
}
}
latestversion := repo.Status.GetLastTagVersion()
if repo.GoState() == "BAD" {
continue
}
if repo.GoState() == "DIRTY" {
continue
}
if repo.Status.CheckPrimativeGoMod() {
log.Info("PRIMATIVE repo:", latestversion, repo.GoPath())
repo.SetGoState("PRIMATIVE")
continue
}
if repo.CheckDirty() {
log.Info("dirty repo:", latestversion, repo.GoPath())
log.Info("dirty repo.getGoSumStatus =", repo.GoState())
repo.SetGoState("DIRTY")
// release.repo.SetValue(repo.status.String())
// release.status.SetValue("dirty")
// release.notes.SetValue("You must commit your changes\nbefore you can continue")
// release.current = repo
// release.openrepo.Enable()
continue
}
if ok, missing := repo.Status.CheckGoSum(); ok {
log.Info("repo has go.sum requirements that are clean")
repo.SetGoState("CLEAN")
} else {
log.Info("repo has go.sum requirements that are screwed up. missing:", missing)
repo.SetGoState("BAD")
// release.repo.SetValue(repo.status.String())
// release.status.SetValue("bad")
// release.notes.SetValue("the go.sum file is wrong")
// release.current = repo
// release.openrepo.Enable()
continue
}
status := repo.State()
if status == "PERFECT" {
continue
} else {
repo.NewScan()
}
log.Info("repo:", latestversion, status, repo.GoPath())
}
log.Info("scanGoSum() did everything, not sure what to do next")
}