guireleaser/lookForUnwind.go

59 lines
1.4 KiB
Go
Raw Normal View History

// This is a simple example
package main
import (
"path/filepath"
2024-02-18 15:09:04 -06:00
"go.wit.com/lib/gui/repolist"
"go.wit.com/log"
)
2024-02-18 15:09:04 -06:00
func lookToUnwind(r *repolist.Repo) bool {
2024-02-18 17:55:59 -06:00
goSumS := r.GoState()
2024-02-18 15:09:04 -06:00
dirtyS := r.State()
currentS := r.Status.GetCurrentBranchVersion()
log.Info("repo:", r.Name(), goSumS, dirtyS, r.State(), currentS)
2024-02-18 15:09:04 -06:00
curName := r.Status.GetCurrentBranchName()
mName := r.Status.GetMasterBranchName()
if curName == mName {
log.Info("\trepo is ready working from main branch", curName, "=", mName)
} else {
log.Info("\trepo is not ready main branch", curName, "!=", mName)
2024-02-18 17:55:59 -06:00
r.SetGoState("CAN NOT UNWIND")
return false
}
2024-02-18 15:09:04 -06:00
if r.LastTag() != currentS {
log.Info("\trepo version mismatch last vs current", r.LastTag(), "!=", currentS)
2024-02-18 17:55:59 -06:00
r.SetGoState("CAN NOT UNWIND")
return false
}
2024-02-18 15:09:04 -06:00
if release.version.String() != r.LastTag() {
log.Info("\trepo version mismatch last vs official", r.LastTag(), "!=", release.version.String())
2024-02-18 17:55:59 -06:00
r.SetGoState("CAN NOT UNWIND")
return false
}
2024-02-18 15:09:04 -06:00
fullpath := filepath.Join(me.goSrcPwd.String(), r.GoPath())
testf := filepath.Join(fullpath, "go.mod")
if Exists(testf) {
log.Info("\trepo is ready. go.mod exists")
2024-02-18 17:55:59 -06:00
r.SetGoState("UNWIND")
return true
}
2024-02-18 15:09:04 -06:00
fullpath = filepath.Join(me.GoSrcPath(), r.GoPath())
testf = filepath.Join(fullpath, "go.sum")
if Exists(testf) {
log.Info("\trepo is ready. go.sum exists")
2024-02-18 17:55:59 -06:00
r.SetGoState("UNWIND")
return true
}
2024-02-18 17:55:59 -06:00
r.SetGoState("NO UNWIND?")
return false
}