From fb88285aeb9e78cb53bba7a5a54cd7306c6263d5 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Tue, 6 Feb 2024 04:03:17 -0600 Subject: [PATCH] go.work file for pkgsite Signed-off-by: Jeff Carr --- globalDisplayOptions.go | 29 ++++++++++++++++++++ main.go | 4 +-- repolist.go | 60 ++++++++++++++++++++--------------------- structs.go | 2 +- 4 files changed, 62 insertions(+), 33 deletions(-) diff --git a/globalDisplayOptions.go b/globalDisplayOptions.go index 126b377..d6e4b7e 100644 --- a/globalDisplayOptions.go +++ b/globalDisplayOptions.go @@ -2,9 +2,14 @@ package main import ( + "fmt" + "os" + "path/filepath" + "go.wit.com/gui" "go.wit.com/lib/debugger" "go.wit.com/lib/gui/logsettings" + "go.wit.com/log" // "go.wit.com/gui/gadgets" ) @@ -71,6 +76,30 @@ func globalDisplayOptions(box *gui.Node) { } me.scanEveryMinute = group1.NewCheckbox("Scan every minute").SetChecked(false) + group1.NewButton("make go.work file", func() { + me.autotypistWindow.Disable() + defer me.autotypistWindow.Enable() + + goSrcDir := me.goSrcPwd.String() + filename := filepath.Join(goSrcDir, "go.work") + + f, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE, 0600) + if err != nil { return } + defer f.Close() + fmt.Fprintln(f, "go 1.21.4") + fmt.Fprintln(f, "") + fmt.Fprintln(f, "use (") + for _, repo := range me.allrepos { + if repo.status.Exists("go.mod") { + fmt.Fprintln(f, "\t"+repo.String()) + } else { + log.Info("missing go.mod for", repo.String()) + repo.status.MakeRedomod() + } + } + fmt.Fprintln(f, ")") + }) + group2 := vbox.NewGroup("Debugger") group2.NewButton("logging Window", func() { logsettings.LogWindow() diff --git a/main.go b/main.go index f713448..7e60afd 100644 --- a/main.go +++ b/main.go @@ -63,8 +63,8 @@ func main() { } func autotypistWindow() { - win := me.myGui.NewWindow("autotypist for GO & git. it types faster than you can.") - box := win.NewBox("bw hbox", true) + me.autotypistWindow = me.myGui.NewWindow("autotypist for GO & git. it types faster than you can.") + box := me.autotypistWindow.NewBox("bw hbox", true) globalDisplayOptions(box) globalBuildOptions(box) diff --git a/repolist.go b/repolist.go index 0d6ffd6..c99e97f 100644 --- a/repolist.go +++ b/repolist.go @@ -201,7 +201,7 @@ func repoAllButtons(box *gui.Node) { grid1.NewButton("merge all user to devel", func() { reposwin.Disable() - if ! mergeAllUserToDevel() { + if !mergeAllUserToDevel() { return } reposwin.Enable() @@ -209,7 +209,7 @@ func repoAllButtons(box *gui.Node) { grid1.NewButton("merge all devel to main", func() { reposwin.Disable() - if ! mergeAllDevelToMain() { + if !mergeAllDevelToMain() { return } reposwin.Enable() @@ -217,10 +217,10 @@ func repoAllButtons(box *gui.Node) { grid1.NewButton("merge it all", func() { reposwin.Disable() - if ! mergeAllUserToDevel() { + if !mergeAllUserToDevel() { return } - if ! mergeAllDevelToMain() { + if !mergeAllDevelToMain() { return } reposwin.Enable() @@ -265,31 +265,31 @@ func mergeAllDevelToMain() bool { } func mergeAllUserToDevel() bool { - log.Info("merge all here") - for _, repo := range me.allrepos { - if repo.status.ReadOnly() { - log.Info("skipping readonly", repo.String(), repo.dirtyLabel.String()) - continue - } - if repo.dirtyLabel.String() != "merge to devel" { - log.Info("skipping. not merge to devel", repo.String(), repo.dirtyLabel.String()) - continue - } - if repo.status.CheckDirty() { - log.Info("skipping dirty", repo.String(), repo.dirtyLabel.String()) - continue - } - log.Info("found", repo.String(), repo.dirtyLabel.String()) - // repo.status.Update() - if repo.status.RunDevelMergeB() { - log.Warn("THINGS SEEM OK fullAutomation() returned true.") - } else { - log.Warn("THINGS FAILED fullAutomation() returned false") - return false - } - repo.status.Update() - repo.newScan() + log.Info("merge all here") + for _, repo := range me.allrepos { + if repo.status.ReadOnly() { + log.Info("skipping readonly", repo.String(), repo.dirtyLabel.String()) + continue } - log.Warn("EVERYTHING WORKED") - return true + if repo.dirtyLabel.String() != "merge to devel" { + log.Info("skipping. not merge to devel", repo.String(), repo.dirtyLabel.String()) + continue + } + if repo.status.CheckDirty() { + log.Info("skipping dirty", repo.String(), repo.dirtyLabel.String()) + continue + } + log.Info("found", repo.String(), repo.dirtyLabel.String()) + // repo.status.Update() + if repo.status.RunDevelMergeB() { + log.Warn("THINGS SEEM OK fullAutomation() returned true.") + } else { + log.Warn("THINGS FAILED fullAutomation() returned false") + return false + } + repo.status.Update() + repo.newScan() + } + log.Warn("EVERYTHING WORKED") + return true } diff --git a/structs.go b/structs.go index d093065..0a649ff 100644 --- a/structs.go +++ b/structs.go @@ -19,7 +19,7 @@ type autoType struct { allrepos map[string]*repo myGui *gui.Node - autotypistWindow *gadgets.BasicWindow + autotypistWindow *gui.Node // #### autotypist Global Display Options autoHidePerfect *gui.Node