try auto go mod tidy
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
766ce60bc3
commit
7dd4dd0808
|
@ -7,8 +7,9 @@ import (
|
|||
|
||||
"go.wit.com/log"
|
||||
|
||||
"go.wit.com/gui/gui"
|
||||
"go.wit.com/gui"
|
||||
"go.wit.com/lib/gadgets"
|
||||
"go.wit.com/lib/gui/repostatus"
|
||||
)
|
||||
|
||||
func doesExist(path string) bool {
|
||||
|
@ -52,18 +53,69 @@ func globalBuildOptions(box *gui.Node) {
|
|||
setCurrentBranch.Set("set all branches to " + me.toMoveToBranch)
|
||||
me.mainBranch.Disable()
|
||||
}
|
||||
me.rerunGoMod = groupvbox.NewButton("re-run go mod & go tidy", func() {
|
||||
me.rerunGoMod.Disable()
|
||||
log.Warn("scanning allrepos")
|
||||
os.Unsetenv("GO111MODULE")
|
||||
for repo, path := range me.allrepos {
|
||||
var cmd []string
|
||||
var err error
|
||||
var b bool
|
||||
var output string
|
||||
|
||||
log.Warn("found repo", path, repo.String())
|
||||
fullpath := "/home/jcarr/go/src/" + path
|
||||
|
||||
me.rerunGoMod.SetText("Running go.mod " + fullpath)
|
||||
|
||||
cmd = []string{"rm", "go.mod", "go.sum"}
|
||||
// log.Warn("Actually RUN path =", fullpath, "cmd =", cmd)
|
||||
err, b, output = repostatus.RunCmd(fullpath, cmd)
|
||||
log.Warn(err, b, string(output))
|
||||
|
||||
log.Sleep(.1)
|
||||
|
||||
cmd = []string{"go", "mod", "init"}
|
||||
// log.Warn("Actually RUN path =", fullpath, "cmd =", cmd)
|
||||
err, b, output = repostatus.RunCmd(fullpath, cmd)
|
||||
log.Warn(err, b, string(output))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
log.Sleep(.1)
|
||||
|
||||
cmd = []string{"go", "mod", "tidy"}
|
||||
// log.Warn("Actually RUN path =", fullpath, "cmd =", cmd)
|
||||
err, b, output = repostatus.RunCmd(fullpath, cmd)
|
||||
log.Warn(err, b, string(output))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
log.Sleep(.2)
|
||||
|
||||
cmd = []string{"git", "status"}
|
||||
// log.Warn("Actually RUN path =", fullpath, "cmd =", cmd)
|
||||
err, b, output = repostatus.RunCmd(fullpath, cmd)
|
||||
log.Warn(err, b, string(output))
|
||||
}
|
||||
me.rerunGoMod.SetText("re-run go mod & go tidy")
|
||||
me.rerunGoMod.Enable()
|
||||
})
|
||||
setCurrentBranch = groupvbox.NewButton("set all branches to", func() {
|
||||
for _, repo := range allrepos {
|
||||
log.Warn("scanning allrepos")
|
||||
for repo, path := range me.allrepos {
|
||||
log.Warn("found repo", repo.String())
|
||||
var changeBranch [][]string
|
||||
// realname, realversion := repo.status.CheckoutBranch(me.toMoveToBranch)
|
||||
// log.Warn("GOT", realname, realversion)
|
||||
path := repo.status.GetPath()
|
||||
// path := repo.status.GetPath()
|
||||
changeBranch = append(changeBranch, []string{"cd", "go/src/" + path})
|
||||
changeBranch = append(changeBranch, []string{"git", "checkout", me.toMoveToBranch})
|
||||
me.script = changeBranch
|
||||
setGitCommands()
|
||||
goMake("--doit")
|
||||
return
|
||||
// goMake("--doit")
|
||||
}
|
||||
})
|
||||
var everything *gui.Node
|
||||
|
@ -71,7 +123,7 @@ func globalBuildOptions(box *gui.Node) {
|
|||
var perfect bool = true
|
||||
var newCmds [][]string
|
||||
// usr, _ := user.Current()
|
||||
newCmds = append(newCmds, []string{"cd", "go/src/gui/app/myrepos"})
|
||||
newCmds = append(newCmds, []string{"cd", "go/src/go.wit.com/apps/myrepos"})
|
||||
repos := myrepolist()
|
||||
for _, line := range repos {
|
||||
log.Warn("repo =", line)
|
||||
|
|
|
@ -4,7 +4,7 @@ package main
|
|||
import (
|
||||
"go.wit.com/log"
|
||||
|
||||
"go.wit.com/gui/gui"
|
||||
"go.wit.com/gui"
|
||||
// "go.wit.com/gui/gadgets"
|
||||
)
|
||||
|
||||
|
@ -32,7 +32,7 @@ func globalDisplayOptions(box *gui.Node) {
|
|||
hidePerfect()
|
||||
})
|
||||
groupvbox.NewButton("show all", func() {
|
||||
for _, repo := range allrepos {
|
||||
for repo, _ := range me.allrepos {
|
||||
if repo.dirtyLabel.String() == "PERFECT" {
|
||||
if repo.hidden {
|
||||
repo.show()
|
||||
|
@ -50,13 +50,13 @@ func globalDisplayOptions(box *gui.Node) {
|
|||
})
|
||||
|
||||
groupvbox.NewButton("status.Update() all", func() {
|
||||
for _, repo := range allrepos {
|
||||
for repo, _ := range me.allrepos {
|
||||
repo.status.Update()
|
||||
}
|
||||
})
|
||||
|
||||
groupvbox.NewButton("rescan all", func() {
|
||||
for _, repo := range allrepos {
|
||||
for repo, _ := range me.allrepos {
|
||||
repo.newScan()
|
||||
}
|
||||
})
|
||||
|
@ -66,7 +66,7 @@ func globalDisplayOptions(box *gui.Node) {
|
|||
}
|
||||
|
||||
func hidePerfect() {
|
||||
for _, repo := range allrepos {
|
||||
for repo, _ := range me.allrepos {
|
||||
if repo.dirtyLabel.String() == "PERFECT" {
|
||||
if repo.hidden {
|
||||
continue
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"go.wit.com/gui/gui"
|
||||
"go.wit.com/gui"
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
|
@ -15,7 +15,7 @@ func globalResetOptions(box *gui.Node) {
|
|||
buildOptions.NewButton("Find", func() {
|
||||
log.Warn("delete every repo marked PERFECT")
|
||||
var newCmds [][]string
|
||||
for _, repo := range allrepos {
|
||||
for repo, _ := range me.allrepos {
|
||||
status := repo.getStatus()
|
||||
if status == "PERFECT" {
|
||||
var line []string
|
||||
|
@ -32,11 +32,11 @@ func globalResetOptions(box *gui.Node) {
|
|||
buildOptions.NewButton("Find", func() {
|
||||
log.Warn("delete every repo marked PERFECT")
|
||||
var newCmds [][]string
|
||||
for _, repo := range allrepos {
|
||||
for repo, path := range me.allrepos {
|
||||
status := repo.getStatus()
|
||||
if status == "PERFECT" {
|
||||
var line []string
|
||||
line = append(line, "rm", "-rf", "go/src/"+repo.path)
|
||||
line = append(line, "rm", "-rf", "go/src/"+path)
|
||||
newCmds = append(newCmds, line)
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ func globalResetOptions(box *gui.Node) {
|
|||
buildOptions.NewButton("rm ~/go/src & ~/go/pkg", func() {
|
||||
var newCmds [][]string
|
||||
var dirty bool = false
|
||||
for _, repo := range allrepos {
|
||||
for repo, _ := range me.allrepos {
|
||||
status := repo.getStatus()
|
||||
if status == "dirty" {
|
||||
dirty = true
|
||||
|
|
15
go.mod
15
go.mod
|
@ -1,18 +1,3 @@
|
|||
module go.wit.com/apps/myrepos
|
||||
|
||||
go 1.21.4
|
||||
|
||||
require (
|
||||
go.wit.com/apps/control-panel-dns v0.12.3
|
||||
go.wit.com/gui/gadgets v0.12.5
|
||||
go.wit.com/gui/gui v0.12.9
|
||||
go.wit.com/gui/lib/repostatus v0.12.7
|
||||
go.wit.com/log v0.5.4
|
||||
)
|
||||
|
||||
require (
|
||||
go.wit.com/dev/alexflint/arg v1.4.5 // indirect
|
||||
go.wit.com/dev/alexflint/scalar v1.2.1 // indirect
|
||||
go.wit.com/dev/davecgh/spew v1.1.4 // indirect
|
||||
go.wit.com/gui/widget v1.1.3 // indirect
|
||||
)
|
||||
|
|
18
go.sum
18
go.sum
|
@ -1,18 +0,0 @@
|
|||
go.wit.com/apps/control-panel-dns v0.12.3 h1:rjQE5YKyieRu6ARzwsNSSiRM9aN325O71MaHRuDUDiA=
|
||||
go.wit.com/apps/control-panel-dns v0.12.3/go.mod h1:wV1THUmfQNaPYetXLSFnotc9m3/nplumk1yiT/yEW4U=
|
||||
go.wit.com/dev/alexflint/arg v1.4.5 h1:asDx5f9IlfpknKjPBqqb2qndE91Pbo7ZDkWUgddfMhY=
|
||||
go.wit.com/dev/alexflint/arg v1.4.5/go.mod h1:wnWc+c6z8kSdDKYriMf6RpM+FiXmo5RYp/t4FNi0MU0=
|
||||
go.wit.com/dev/alexflint/scalar v1.2.1 h1:loXOcbVnd+8YeJRLey+XXidecBiedMDO00zQ26TvKNs=
|
||||
go.wit.com/dev/alexflint/scalar v1.2.1/go.mod h1:+rYsfxqdI2cwA8kJ7GCMwWbNJvfvWUurOCXLiwdTtSs=
|
||||
go.wit.com/dev/davecgh/spew v1.1.4 h1:C9hj/rjlUpdK+E6aroyLjCbS5MFcyNUOuP1ICLWdNek=
|
||||
go.wit.com/dev/davecgh/spew v1.1.4/go.mod h1:sihvWmnQ/09FWplnEmozt90CCVqBtGuPXM811tgfhFA=
|
||||
go.wit.com/gui/gadgets v0.12.5 h1:Eg7UbwnvwGgYlNX+sgKQNVcbRMZyYL4ChDmS2p/DHtM=
|
||||
go.wit.com/gui/gadgets v0.12.5/go.mod h1:OB7MtEZy/VK2HrU3yiEuzY9n4LjZwO0L06NYUAFybJs=
|
||||
go.wit.com/gui/gui v0.12.9 h1:Xrs8v/gbbQnsjCnF3BCNXgddH5oB8xTjlysL9Ul1aRs=
|
||||
go.wit.com/gui/gui v0.12.9/go.mod h1:YgbFWxsGqZb45oLGaHim2GukPzPgMLQcVRRI0QkrGS8=
|
||||
go.wit.com/gui/lib/repostatus v0.12.7 h1:YF+jfEXlfbacthWrwy+844Uk4UyRQQP35MuRL3bHKOo=
|
||||
go.wit.com/gui/lib/repostatus v0.12.7/go.mod h1:WgfUiAc/WQCTndBfwj+oUeDXifwMh7wEIs7zOW2hsNY=
|
||||
go.wit.com/gui/widget v1.1.3 h1:GvLzGSOF9tfmoh6HNbFdN+NSlBo2qeS/Ba2TnQQ1A1U=
|
||||
go.wit.com/gui/widget v1.1.3/go.mod h1:A6/FaiFQtAHTjgo7c4FrokXe6bXX1Cowo35b2Lgi31E=
|
||||
go.wit.com/log v0.5.4 h1:vijLRPTUgChb8J5tx/7Uma/lGTUxeSXosFbheAmL914=
|
||||
go.wit.com/log v0.5.4/go.mod h1:BaJBfHFqcJSJLXGQ9RHi3XVhPgsStxSMZRlaRxW4kAo=
|
23
main.go
23
main.go
|
@ -7,7 +7,7 @@ import (
|
|||
|
||||
"go.wit.com/log"
|
||||
|
||||
"go.wit.com/gui/gui"
|
||||
"go.wit.com/gui"
|
||||
"go.wit.com/lib/gadgets"
|
||||
"go.wit.com/lib/gui/repostatus"
|
||||
)
|
||||
|
@ -16,10 +16,13 @@ import (
|
|||
var resToolkit embed.FS
|
||||
|
||||
func main() {
|
||||
myGui = gui.New()
|
||||
myGui.InitEmbed(resToolkit)
|
||||
myGui.LoadToolkit("nocui")
|
||||
myGui.Default()
|
||||
me = new(repoType)
|
||||
me.allrepos = make(map[*repo]string)
|
||||
|
||||
me.myGui = gui.New()
|
||||
me.myGui.InitEmbed(resToolkit)
|
||||
me.myGui.LoadToolkit("nocui")
|
||||
me.myGui.Default()
|
||||
|
||||
autotypistWindow()
|
||||
// repoworld()
|
||||
|
@ -64,26 +67,26 @@ func addRepo(grid *gui.Node, path string, master string, devel string, user stri
|
|||
newRepo.cButton.Hide()
|
||||
newRepo.pButton.Hide()
|
||||
}
|
||||
newRepo.status = repostatus.New(myGui, newRepo.path)
|
||||
newRepo.status = repostatus.New(me.myGui, newRepo.path)
|
||||
newRepo.status.SetMasterName(master)
|
||||
newRepo.status.SetDevelName(devel)
|
||||
newRepo.status.SetUserName(user)
|
||||
newRepo.hidden = false
|
||||
newRepo.status.Update()
|
||||
newRepo.newScan()
|
||||
allrepos = append(allrepos, newRepo)
|
||||
me.allrepos[newRepo] = path
|
||||
}
|
||||
|
||||
func autotypistWindow() {
|
||||
/*
|
||||
me.autotypistWindow = gadgets.NewBasicWindow(myGui, "autotypist for GO & git. it types faster than you can.")
|
||||
me.autotypistWindow = gadgets.NewBasicWindow(me.myGui, "autotypist for GO & git. it types faster than you can.")
|
||||
me.autotypistWindow.Make()
|
||||
me.autotypistWindow.StandardExit()
|
||||
|
||||
box := me.autotypistWindow.Box()
|
||||
me.autotypistWindow.Draw()
|
||||
*/
|
||||
win := myGui.NewWindow("autotypist for GO & git. it types faster than you can.")
|
||||
win := me.myGui.NewWindow("autotypist for GO & git. it types faster than you can.")
|
||||
box := win.NewBox("bw hbox", true)
|
||||
globalDisplayOptions(box)
|
||||
globalBuildOptions(box)
|
||||
|
@ -93,7 +96,7 @@ func autotypistWindow() {
|
|||
|
||||
// This creates a window
|
||||
func repoworld() {
|
||||
reposwin = gadgets.NewBasicWindow(myGui, "All git repositories in ~/go/src/")
|
||||
reposwin = gadgets.NewBasicWindow(me.myGui, "All git repositories in ~/go/src/")
|
||||
reposwin.Make()
|
||||
|
||||
reposbox = reposwin.Box().NewBox("bw vbox", false)
|
||||
|
|
|
@ -6,6 +6,10 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
func (r *repo) String() string {
|
||||
return r.status.String()
|
||||
}
|
||||
|
||||
func (r *repo) getPath() string {
|
||||
return r.path
|
||||
}
|
||||
|
|
13
structs.go
13
structs.go
|
@ -2,22 +2,23 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"go.wit.com/gui/gui"
|
||||
"go.wit.com/gui"
|
||||
"go.wit.com/lib/gadgets"
|
||||
"go.wit.com/lib/gui/repostatus"
|
||||
)
|
||||
|
||||
// the main window nodes
|
||||
var myGui *gui.Node
|
||||
var reposwin *gadgets.BasicWindow
|
||||
var reposbox *gui.Node
|
||||
var reposgrid *gui.Node
|
||||
var reposgroup *gui.Node
|
||||
|
||||
var me repoType
|
||||
var me *repoType
|
||||
|
||||
type repoType struct {
|
||||
script [][]string
|
||||
script [][]string
|
||||
allrepos map[*repo]string
|
||||
myGui *gui.Node
|
||||
|
||||
// #### autotypist window
|
||||
autotypistWindow *gadgets.BasicWindow
|
||||
|
@ -36,6 +37,8 @@ type repoType struct {
|
|||
develBranch *gadgets.BasicCombobox
|
||||
userBranch *gadgets.BasicCombobox
|
||||
|
||||
// this button will regenerate everyones go.mod & go.sum
|
||||
rerunGoMod *gui.Node
|
||||
// #### autotypist Global Distructive & Reset Options
|
||||
// #### autotypist window end
|
||||
}
|
||||
|
@ -44,8 +47,6 @@ var cmds *gui.Node
|
|||
var doit *gui.Node
|
||||
var dryrun *gui.Node
|
||||
|
||||
var allrepos []*repo
|
||||
|
||||
type repo struct {
|
||||
hidden bool
|
||||
path string
|
||||
|
|
Loading…
Reference in New Issue