still invalid repos getting in the repos.pb
This commit is contained in:
parent
816760d137
commit
1d352604b9
23
Makefile
23
Makefile
|
@ -12,11 +12,12 @@ verbose:
|
||||||
GO111MODULE=off go build -v -x \
|
GO111MODULE=off go build -v -x \
|
||||||
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
||||||
|
|
||||||
install:
|
install: goimports
|
||||||
GO111MODULE=off go install \
|
GO111MODULE=off go install \
|
||||||
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
||||||
|
|
||||||
goimports:
|
goimports:
|
||||||
|
reset
|
||||||
goimports -w *.go
|
goimports -w *.go
|
||||||
@# // to globally reset paths:
|
@# // to globally reset paths:
|
||||||
@# // gofmt -w -r '"go.wit.com/gui/gadgets" -> "go.wit.com/lib/gadgets"' *.go
|
@# // gofmt -w -r '"go.wit.com/gui/gadgets" -> "go.wit.com/lib/gadgets"' *.go
|
||||||
|
@ -24,37 +25,25 @@ goimports:
|
||||||
gocui: install
|
gocui: install
|
||||||
forge --gui gocui
|
forge --gui gocui
|
||||||
|
|
||||||
check-git-clean:
|
|
||||||
@git diff-index --quiet HEAD -- || (echo "Git repository is dirty, please commit your changes first"; exit 1)
|
|
||||||
|
|
||||||
redomod:
|
|
||||||
rm -f go.*
|
|
||||||
GO111MODULE= go mod init
|
|
||||||
GO111MODULE= go mod tidy
|
|
||||||
|
|
||||||
redomod-all:
|
redomod-all:
|
||||||
forge --do-RedoGoMod
|
forge --do-RedoGoMod
|
||||||
|
|
||||||
redomod-erase:
|
redomod-erase:
|
||||||
forge --do-RedoGoMod --do-erase
|
forge --do-RedoGoMod --do-erase
|
||||||
|
|
||||||
list: install
|
|
||||||
reset
|
|
||||||
forge --do-list
|
|
||||||
|
|
||||||
private: install
|
private: install
|
||||||
reset
|
reset
|
||||||
forge --find-private
|
forge --find-private
|
||||||
|
|
||||||
list-fix: install
|
fix: install
|
||||||
reset
|
reset
|
||||||
forge --do-list --do-fix
|
forge --fix
|
||||||
|
|
||||||
list-readonly: install
|
readonly: install
|
||||||
reset
|
reset
|
||||||
forge --do-list --find-readonly
|
forge --do-list --find-readonly
|
||||||
|
|
||||||
list-config: install
|
config: install
|
||||||
forge --config
|
forge --config
|
||||||
|
|
||||||
scan: install
|
scan: install
|
||||||
|
|
|
@ -87,12 +87,11 @@ func verifyPrint(repo *gitpb.Repo) {
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if me.forge.Config.IsReadOnly(repo.GoPath) && !argv.FindReadOnly {
|
if me.forge.Config.IsReadOnly(repo.GoPath) {
|
||||||
if repo.ReadOnly {
|
if repo.ReadOnly {
|
||||||
return
|
} else {
|
||||||
}
|
|
||||||
log.Info("readonly flag on repo is wrong", repo.GoPath)
|
log.Info("readonly flag on repo is wrong", repo.GoPath)
|
||||||
return
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var mhort string = s["mver"]
|
var mhort string = s["mver"]
|
||||||
|
@ -111,7 +110,7 @@ func verifyPrint(repo *gitpb.Repo) {
|
||||||
|
|
||||||
func verify(repo *gitpb.Repo, s map[string]string) bool {
|
func verify(repo *gitpb.Repo, s map[string]string) bool {
|
||||||
if !repo.IsValid() {
|
if !repo.IsValid() {
|
||||||
return false
|
// return false
|
||||||
}
|
}
|
||||||
s["gopath"] = repo.GetGoPath()
|
s["gopath"] = repo.GetGoPath()
|
||||||
s["rtype"] = repo.RepoType()
|
s["rtype"] = repo.RepoType()
|
|
@ -0,0 +1,25 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import "go.wit.com/log"
|
||||||
|
|
||||||
|
func doScan() {
|
||||||
|
me.forge.ScanGoSrc()
|
||||||
|
}
|
||||||
|
|
||||||
|
func doGitPull() {
|
||||||
|
me.found.RillGitPull()
|
||||||
|
}
|
||||||
|
|
||||||
|
func doFix() {
|
||||||
|
all := me.found.SortByGoPath()
|
||||||
|
for all.Scan() {
|
||||||
|
repo := all.Next()
|
||||||
|
if !repo.IsValid() {
|
||||||
|
log.Printf("%10s %-50s", "old?\n", repo.GetGoPath())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
log.Printf("running on: %-50s\n", repo.GetGoPath())
|
||||||
|
cmd := []string{"ls"}
|
||||||
|
repo.Run(cmd)
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,31 +0,0 @@
|
||||||
package main
|
|
||||||
|
|
||||||
/*
|
|
||||||
this parses the command line arguements
|
|
||||||
|
|
||||||
this enables command line options from other packages like 'gui' and 'log'
|
|
||||||
*/
|
|
||||||
|
|
||||||
import (
|
|
||||||
"go.wit.com/lib/debugger"
|
|
||||||
"go.wit.com/lib/gui/logsettings"
|
|
||||||
"go.wit.com/log"
|
|
||||||
)
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
if debugger.ArgDebug() {
|
|
||||||
log.Info("cmd line --debugger == true")
|
|
||||||
go func() {
|
|
||||||
log.Sleep(2)
|
|
||||||
debugger.DebugWindow()
|
|
||||||
}()
|
|
||||||
}
|
|
||||||
if debugger.ArgLogger() {
|
|
||||||
log.Info("cmd line --loggger == true")
|
|
||||||
go func() {
|
|
||||||
log.Sleep(4)
|
|
||||||
logsettings.LogWindow()
|
|
||||||
logsettings.LogWindow()
|
|
||||||
}()
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
package main
|
|
||||||
|
|
||||||
// An app to submit patches for the 30 GO GUI repos
|
|
||||||
|
|
||||||
func doGitPull() {
|
|
||||||
me.found.RillGitPull()
|
|
||||||
}
|
|
|
@ -2,52 +2,22 @@ package main
|
||||||
|
|
||||||
import "go.wit.com/log"
|
import "go.wit.com/log"
|
||||||
|
|
||||||
func findPrivate() {
|
|
||||||
repos := me.forge.Repos.SortByGoPath()
|
|
||||||
for repos.Scan() {
|
|
||||||
repo := repos.Next()
|
|
||||||
if me.forge.Config.IsPrivate(repo.GoPath) {
|
|
||||||
me.found.AppendUniqueGoPath(repo)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// finds repos that are writable
|
|
||||||
func findMine() {
|
|
||||||
log.Printf("get mine %s\n", me.forge.GetGoSrc())
|
|
||||||
repos := me.forge.Repos.SortByGoPath()
|
|
||||||
for repos.Scan() {
|
|
||||||
repo := repos.Next()
|
|
||||||
if me.forge.Config.IsWritable(repo.GoPath) {
|
|
||||||
me.found.AppendUniqueGoPath(repo)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// finds repos that are writable
|
|
||||||
func findFavorites() {
|
|
||||||
log.Printf("get mine %s\n", me.forge.GetGoSrc())
|
|
||||||
repos := me.forge.Repos.SortByGoPath()
|
|
||||||
for repos.Scan() {
|
|
||||||
repo := repos.Next()
|
|
||||||
if me.forge.Config.IsFavorite(repo.GoPath) {
|
|
||||||
me.found.AppendUniqueGoPath(repo)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// retuns true if nothing was done
|
// retuns true if nothing was done
|
||||||
func findConfig() bool {
|
func findConfig() bool {
|
||||||
|
var done bool = false
|
||||||
if argv.FindMine {
|
if argv.FindMine {
|
||||||
findConfigMine()
|
findConfigMine()
|
||||||
return false
|
done = true
|
||||||
}
|
}
|
||||||
if argv.FindAll {
|
if argv.FindAll {
|
||||||
findConfigAll()
|
findConfigAll()
|
||||||
return false
|
done = true
|
||||||
}
|
}
|
||||||
|
if !done {
|
||||||
return true
|
findConfigAll()
|
||||||
|
done = true
|
||||||
|
}
|
||||||
|
return done
|
||||||
}
|
}
|
||||||
|
|
||||||
// finds config repos that are writable
|
// finds config repos that are writable
|
||||||
|
|
77
findRepos.go
77
findRepos.go
|
@ -4,8 +4,71 @@ import (
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
func findRepos() {
|
func findRepos() bool {
|
||||||
|
var done bool = false
|
||||||
if argv.FindAll {
|
if argv.FindAll {
|
||||||
|
findAll()
|
||||||
|
done = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if argv.FindPrivate {
|
||||||
|
findPrivate()
|
||||||
|
done = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if argv.FindMine {
|
||||||
|
findMine()
|
||||||
|
done = true
|
||||||
|
}
|
||||||
|
if argv.FindFavorites {
|
||||||
|
findFavorites()
|
||||||
|
done = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// this is the 'default' behavior when no command line arguments are given
|
||||||
|
// if no argv was set, select repos marked as 'mine'
|
||||||
|
if !done {
|
||||||
|
findMine()
|
||||||
|
done = true
|
||||||
|
}
|
||||||
|
return done
|
||||||
|
}
|
||||||
|
|
||||||
|
func findPrivate() {
|
||||||
|
repos := me.forge.Repos.SortByGoPath()
|
||||||
|
for repos.Scan() {
|
||||||
|
repo := repos.Next()
|
||||||
|
if me.forge.Config.IsPrivate(repo.GoPath) {
|
||||||
|
me.found.AppendUniqueGoPath(repo)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// finds repos that are writable
|
||||||
|
func findMine() {
|
||||||
|
// log.Printf("get mine %s\n", me.forge.GetGoSrc())
|
||||||
|
repos := me.forge.Repos.SortByGoPath()
|
||||||
|
for repos.Scan() {
|
||||||
|
repo := repos.Next()
|
||||||
|
if me.forge.Config.IsWritable(repo.GoPath) {
|
||||||
|
me.found.AppendUniqueGoPath(repo)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// finds repos that are writable
|
||||||
|
func findFavorites() {
|
||||||
|
// log.Printf("get favorites %s\n", me.forge.GetGoSrc())
|
||||||
|
repos := me.forge.Repos.SortByGoPath()
|
||||||
|
for repos.Scan() {
|
||||||
|
repo := repos.Next()
|
||||||
|
if me.forge.Config.IsFavorite(repo.GoPath) {
|
||||||
|
me.found.AppendUniqueGoPath(repo)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func findAll() {
|
||||||
var configsave bool
|
var configsave bool
|
||||||
repos := me.forge.Repos.SortByGoPath()
|
repos := me.forge.Repos.SortByGoPath()
|
||||||
for repos.Scan() {
|
for repos.Scan() {
|
||||||
|
@ -25,16 +88,4 @@ func findRepos() {
|
||||||
log.Info("should ConfigSave here")
|
log.Info("should ConfigSave here")
|
||||||
me.forge.Repos.ConfigSave()
|
me.forge.Repos.ConfigSave()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if argv.FindPrivate {
|
|
||||||
findPrivate()
|
|
||||||
}
|
|
||||||
|
|
||||||
if argv.FindMine {
|
|
||||||
findMine()
|
|
||||||
}
|
|
||||||
if argv.FindFavorites {
|
|
||||||
findFavorites()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
8
main.go
8
main.go
|
@ -46,16 +46,24 @@ func main() {
|
||||||
doRedoGoMod()
|
doRedoGoMod()
|
||||||
done = true
|
done = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if argv.DoGitPull {
|
if argv.DoGitPull {
|
||||||
doGitPull()
|
doGitPull()
|
||||||
done = true
|
done = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if argv.DoList {
|
if argv.DoList {
|
||||||
// print out the repos
|
// print out the repos
|
||||||
doCobol()
|
doCobol()
|
||||||
done = true
|
done = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if argv.Fix {
|
||||||
|
// print out the repos
|
||||||
|
doFix()
|
||||||
|
done = true
|
||||||
|
}
|
||||||
|
|
||||||
// do the gui at the very end
|
// do the gui at the very end
|
||||||
if argv.DoGui {
|
if argv.DoGui {
|
||||||
doGui()
|
doGui()
|
||||||
|
|
Loading…
Reference in New Issue