summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-30 23:55:04 -0600
committerJeff Carr <[email protected]>2024-01-30 23:55:04 -0600
commit6d59e0f0f7db343b00748a98e19286994fcbf19f (patch)
treef539294e6a4ef8ac48f50ae3ac388573ec992cf8
parentd18a8018cb95cd3218226639e6afa5b4e3f51af0 (diff)
more code cleanups
Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--globalBuildOptions.go2
-rw-r--r--globalResetOptions.go3
-rw-r--r--main.go9
-rw-r--r--repolist.go24
-rw-r--r--scan.go82
-rw-r--r--structs.go2
6 files changed, 20 insertions, 102 deletions
diff --git a/globalBuildOptions.go b/globalBuildOptions.go
index 5668e4f..e9aa180 100644
--- a/globalBuildOptions.go
+++ b/globalBuildOptions.go
@@ -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")
diff --git a/globalResetOptions.go b/globalResetOptions.go
index 390cda2..900162c 100644
--- a/globalResetOptions.go
+++ b/globalResetOptions.go
@@ -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
diff --git a/main.go b/main.go
index d71348b..f713448 100644
--- a/main.go
+++ b/main.go
@@ -3,7 +3,6 @@ package main
import (
"embed"
- "fmt"
"time"
"go.wit.com/log"
@@ -50,15 +49,15 @@ func main() {
return
}
i = 0
- duration := timeFunction(func() {
- scanGoSum()
+ timeFunction(func() {
+ // scanGoSum()
for _, repo := range me.allrepos {
repo.newScan()
}
})
/*
- s := fmt.Sprint(duration)
- me.autoWorkingPwd.SetText(s)
+ s := fmt.Sprint(duration)
+ me.autoWorkingPwd.SetText(s)
*/
})
}
diff --git a/repolist.go b/repolist.go
index c7106dc..229fa0d 100644
--- a/repolist.go
+++ b/repolist.go
@@ -277,17 +277,19 @@ func repoAllButtons(box *gui.Node) {
}
})
- grid1.NewButton("rescan all", func() {
- for _, repo := range me.allrepos {
- repo.newScan()
- }
- })
+ /*
+ grid1.NewButton("rescan all", func() {
+ for _, repo := range me.allrepos {
+ repo.newScan()
+ }
+ })
- grid1.NewButton("repostatus.ListAll()", func() {
- repostatus.ListAll()
- })
+ grid1.NewButton("repostatus.ListAll()", func() {
+ repostatus.ListAll()
+ })
- grid1.NewButton("repostatus.ScanGoSrc()", func() {
- repostatus.ScanGoSrc()
- })
+ grid1.NewButton("repostatus.ScanGoSrc()", func() {
+ repostatus.ScanGoSrc()
+ })
+ */
}
diff --git a/scan.go b/scan.go
index e0c9761..0818c85 100644
--- a/scan.go
+++ b/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
diff --git a/structs.go b/structs.go
index 9958845..d093065 100644
--- a/structs.go
+++ b/structs.go
@@ -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