guireleaser/lookForUnwind.go

58 lines
1.5 KiB
Go

// This is a simple example
package main
import (
"path/filepath"
"go.wit.com/log"
)
func (r *repo) lookToUnwind() bool {
goSumS := r.getGoSumStatus()
dirtyS := r.dirtyLabel.String()
currentS := r.status.GetCurrentBranchVersion()
log.Info("repo:", r.String(), goSumS, dirtyS, r.lastTag.String(), currentS)
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)
r.setGoSumStatus("CAN NOT UNWIND")
return false
}
if r.lastTag.String() != currentS {
log.Info("\trepo version mismatch last vs current", r.lastTag.String(), "!=", currentS)
r.setGoSumStatus("CAN NOT UNWIND")
return false
}
if "v"+release.versionS != r.lastTag.String() {
log.Info("\trepo version mismatch last vs official", r.lastTag.String(), "!=", release.versionS)
r.setGoSumStatus("CAN NOT UNWIND")
return false
}
fullpath := filepath.Join(me.goSrcPwd.String(), r.String())
testf := filepath.Join(fullpath, "go.mod")
if Exists(testf) {
log.Info("\trepo is ready. go.mod exists")
r.setGoSumStatus("UNWIND")
return true
}
fullpath = filepath.Join(me.goSrcPwd.String(), r.String())
testf = filepath.Join(fullpath, "go.sum")
if Exists(testf) {
log.Info("\trepo is ready. go.sum exists")
r.setGoSumStatus("UNWIND")
return true
}
r.setGoSumStatus("NO UNWIND?")
return false
}