more code cleanups
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
d18a8018cb
commit
6d59e0f0f7
|
@ -60,7 +60,7 @@ func globalBuildOptions(box *gui.Node) {
|
|||
group1 := vbox.NewGroup("Global Build Options")
|
||||
grid := group1.NewGrid("buildOptions", 2, 1)
|
||||
|
||||
// me.autoWorkingPwd = gadgets.NewOneLiner(grid, "working directory (pwd)")
|
||||
me.autoWorkingPwd = gadgets.NewOneLiner(grid, "working directory (pwd)")
|
||||
me.userHomePwd = gadgets.NewOneLiner(grid, "user home")
|
||||
me.goSrcPwd = gadgets.NewOneLiner(grid, "go src home")
|
||||
|
||||
|
|
|
@ -16,8 +16,7 @@ func globalResetOptions(box *gui.Node) {
|
|||
buildOptions.NewLabel("start over")
|
||||
me.deleteGoSrcPkgB = buildOptions.NewButton("rm ~/go/src & ~/go/pkg", func() {
|
||||
for _, repo := range me.allrepos {
|
||||
// status := repo.getStatus()
|
||||
if repo.checkDirty() {
|
||||
if repo.status.CheckDirty() {
|
||||
log.Warn("repo is dirty. commit your changes first", repo.String())
|
||||
me.deleteGoSrcPkgB.SetLabel("rm ~/go/src (can't. dirty repos)")
|
||||
return
|
||||
|
|
5
main.go
5
main.go
|
@ -3,7 +3,6 @@ package main
|
|||
|
||||
import (
|
||||
"embed"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"go.wit.com/log"
|
||||
|
@ -50,8 +49,8 @@ func main() {
|
|||
return
|
||||
}
|
||||
i = 0
|
||||
duration := timeFunction(func() {
|
||||
scanGoSum()
|
||||
timeFunction(func() {
|
||||
// scanGoSum()
|
||||
for _, repo := range me.allrepos {
|
||||
repo.newScan()
|
||||
}
|
||||
|
|
|
@ -277,6 +277,7 @@ func repoAllButtons(box *gui.Node) {
|
|||
}
|
||||
})
|
||||
|
||||
/*
|
||||
grid1.NewButton("rescan all", func() {
|
||||
for _, repo := range me.allrepos {
|
||||
repo.newScan()
|
||||
|
@ -290,4 +291,5 @@ func repoAllButtons(box *gui.Node) {
|
|||
grid1.NewButton("repostatus.ScanGoSrc()", func() {
|
||||
repostatus.ScanGoSrc()
|
||||
})
|
||||
*/
|
||||
}
|
||||
|
|
82
scan.go
82
scan.go
|
@ -65,88 +65,6 @@ func (r *repo) newScan() bool {
|
|||
return false
|
||||
}
|
||||
|
||||
func (r *repo) getGoSumStatus() string {
|
||||
return r.goSumStatus.String()
|
||||
}
|
||||
|
||||
func (r *repo) setGoSumStatus(s string) {
|
||||
r.goSumStatus.SetLabel(s)
|
||||
r.status.SetGoSumStatus(s)
|
||||
}
|
||||
|
||||
func (r *repo) checkDirty() bool {
|
||||
if r.status.CheckDirty() {
|
||||
log.Info("dirty repo:", r.status.String(), r.getGoSumStatus())
|
||||
r.setGoSumStatus("DIRTY")
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (r *repo) checkSafeGoSumRemake() {
|
||||
if ok, bad := r.status.CheckSafeGoSumRemake(); ok {
|
||||
log.Info("checkSafeGoSumRemake() is safe to redo")
|
||||
r.setGoSumStatus("SAFE")
|
||||
r.status.MakeRedomod()
|
||||
} else {
|
||||
log.Info("checkSafeGoSumRemake() is not safe. problems:", bad)
|
||||
r.setGoSumStatus("BAD DEP")
|
||||
}
|
||||
}
|
||||
|
||||
func scanGoSum() {
|
||||
for _, repo := range me.allrepos {
|
||||
latestversion := repo.status.GetLastTagVersion()
|
||||
if repo.getGoSumStatus() == "BAD" {
|
||||
continue
|
||||
}
|
||||
if repo.getGoSumStatus() == "DIRTY" {
|
||||
continue
|
||||
}
|
||||
if repo.status.CheckPrimativeGoMod() {
|
||||
log.Info("PRIMATIVE repo:", latestversion, repo.status.String())
|
||||
repo.setGoSumStatus("PRIMATIVE")
|
||||
continue
|
||||
}
|
||||
if repo.checkDirty() {
|
||||
log.Info("dirty repo:", latestversion, repo.status.String())
|
||||
log.Info("dirty repo.getGoSumStatus =", repo.getGoSumStatus())
|
||||
repo.setGoSumStatus("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.setGoSumStatus("CLEAN")
|
||||
} else {
|
||||
log.Info("repo has go.sum requirements that are screwed up. missing:", missing)
|
||||
repo.setGoSumStatus("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.dirtyLabel.String()
|
||||
if status == "PERFECT" {
|
||||
continue
|
||||
} else {
|
||||
repo.status.Update()
|
||||
repo.newScan()
|
||||
}
|
||||
|
||||
log.Info("repo:", latestversion, status, repo.status.String())
|
||||
}
|
||||
log.Info("scanGoSum() did everything, not sure what to do next")
|
||||
}
|
||||
|
||||
// timeFunction takes a function as an argument and returns the execution time.
|
||||
func timeFunction(f func()) time.Duration {
|
||||
startTime := time.Now() // Record the start time
|
||||
|
|
|
@ -53,7 +53,7 @@ type autoType struct {
|
|||
scanEveryMinute *gui.Node
|
||||
|
||||
// The current working directory
|
||||
// autoWorkingPwd *gadgets.OneLiner
|
||||
autoWorkingPwd *gadgets.OneLiner
|
||||
|
||||
// what is being used as your home dir
|
||||
userHomePwd *gadgets.OneLiner
|
||||
|
|
Loading…
Reference in New Issue