guireleaser/scanGoSum.go

87 lines
2.2 KiB
Go
Raw Normal View History

2024-02-17 14:21:05 -06:00
// This is a simple example
package main
import (
2024-02-18 15:09:04 -06:00
"go.wit.com/lib/gui/repolist"
2024-02-17 14:21:05 -06:00
"go.wit.com/log"
)
2024-02-18 15:09:04 -06:00
/*
func getGoSumStatus(r *repolist.Repo) string {
return r.Status.GoSumStatus.String()
2024-02-17 14:21:05 -06:00
}
2024-02-18 15:09:04 -06:00
func setGoSumStatus(r *repolist.Repo, s string) {
2024-02-17 14:21:05 -06:00
r.goSumStatus.SetLabel(s)
r.status.SetGoSumStatus(s)
}
2024-02-18 15:09:04 -06:00
*/
2024-02-17 14:21:05 -06:00
2024-02-18 15:09:04 -06:00
func checkSafeGoSumRemake(r *repolist.Repo) {
if ok, bad := r.Status.CheckSafeGoSumRemake(); ok {
2024-02-17 14:21:05 -06:00
log.Info("checkSafeGoSumRemake() is safe to redo")
2024-02-18 15:09:04 -06:00
r.Status.SetGoSumStatus("SAFE")
r.Status.MakeRedomod()
2024-02-17 14:21:05 -06:00
} else {
log.Info("checkSafeGoSumRemake() is not safe. problems:", bad)
2024-02-18 15:09:04 -06:00
r.Status.SetGoSumStatus("BAD DEP")
2024-02-17 14:21:05 -06:00
}
}
func scanGoSum() {
2024-02-18 15:09:04 -06:00
for _, repo := range me.repos.View.AllRepos() {
if repo.GoPath() == "go.wit.com/apps/guireleaser" {
2024-02-17 14:21:05 -06:00
if release.guireleaser == nil {
release.guireleaser = repo
}
}
2024-02-18 15:09:04 -06:00
latestversion := repo.Status.GetLastTagVersion()
if repo.GoState() == "BAD" {
2024-02-17 14:21:05 -06:00
continue
}
2024-02-18 15:09:04 -06:00
if repo.GoState() == "DIRTY" {
2024-02-17 14:21:05 -06:00
continue
}
2024-02-18 15:09:04 -06:00
if repo.Status.CheckPrimativeGoMod() {
log.Info("PRIMATIVE repo:", latestversion, repo.GoPath())
repo.SetGoState("PRIMATIVE")
2024-02-17 14:21:05 -06:00
continue
}
2024-02-18 15:09:04 -06:00
if repo.CheckDirty() {
log.Info("dirty repo:", latestversion, repo.GoPath())
log.Info("dirty repo.getGoSumStatus =", repo.GoState())
repo.SetGoState("DIRTY")
2024-02-17 14:21:05 -06:00
// 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
}
2024-02-18 15:09:04 -06:00
if ok, missing := repo.Status.CheckGoSum(); ok {
2024-02-17 14:21:05 -06:00
log.Info("repo has go.sum requirements that are clean")
2024-02-18 15:09:04 -06:00
repo.SetGoState("CLEAN")
2024-02-17 14:21:05 -06:00
} else {
log.Info("repo has go.sum requirements that are screwed up. missing:", missing)
2024-02-18 15:09:04 -06:00
repo.SetGoState("BAD")
2024-02-17 14:21:05 -06:00
// 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
}
2024-02-18 15:09:04 -06:00
status := repo.State()
2024-02-17 14:21:05 -06:00
if status == "PERFECT" {
continue
} else {
2024-02-18 15:09:04 -06:00
repo.NewScan()
2024-02-17 14:21:05 -06:00
}
2024-02-18 15:09:04 -06:00
log.Info("repo:", latestversion, status, repo.GoPath())
2024-02-17 14:21:05 -06:00
}
log.Info("scanGoSum() did everything, not sure what to do next")
}