2024-01-31 06:05:11 -06:00
|
|
|
// This is a simple example
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2024-01-31 06:53:20 -06:00
|
|
|
"path/filepath"
|
|
|
|
|
2024-01-31 06:05:11 -06:00
|
|
|
"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
|
|
|
|
}
|
|
|
|
|
2024-02-01 13:30:26 -06:00
|
|
|
if release.version.String() != r.lastTag.String() {
|
|
|
|
log.Info("\trepo version mismatch last vs official", r.lastTag.String(), "!=", release.version.String())
|
2024-01-31 06:05:11 -06:00
|
|
|
r.setGoSumStatus("CAN NOT UNWIND")
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2024-01-31 06:53:20 -06:00
|
|
|
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
|
2024-01-31 06:05:11 -06:00
|
|
|
}
|