lots more code cleanups
This commit is contained in:
parent
7cade75da8
commit
b3bfa8915c
|
@ -0,0 +1,24 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.wit.com/lib/gui/shell"
|
||||||
|
"go.wit.com/log"
|
||||||
|
)
|
||||||
|
|
||||||
|
func build() error {
|
||||||
|
err := forge.Build(workingRepo, nil)
|
||||||
|
pwd, _ := os.Getwd()
|
||||||
|
if err == nil {
|
||||||
|
log.Info("this totally worked", pwd)
|
||||||
|
shell.RunEcho([]string{"ls", "-l"})
|
||||||
|
log.Info("ran ls")
|
||||||
|
} else {
|
||||||
|
log.Info("this totally did not work", pwd)
|
||||||
|
shell.RunEcho([]string{"ls", "-l"})
|
||||||
|
log.Info("ran ls")
|
||||||
|
badExit(err)
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
6
clone.go
6
clone.go
|
@ -76,6 +76,8 @@ func recursiveClone(check *gitpb.Repo) error {
|
||||||
var good int
|
var good int
|
||||||
var bad int
|
var bad int
|
||||||
|
|
||||||
|
badmap := make(map[string]error)
|
||||||
|
|
||||||
if check == nil {
|
if check == nil {
|
||||||
return errors.New("repo was nil")
|
return errors.New("repo was nil")
|
||||||
}
|
}
|
||||||
|
@ -111,6 +113,7 @@ func recursiveClone(check *gitpb.Repo) error {
|
||||||
log.Info("recursiveClone() could not download", depRepo.GoPath)
|
log.Info("recursiveClone() could not download", depRepo.GoPath)
|
||||||
log.Info("err:", err)
|
log.Info("err:", err)
|
||||||
bad += 1
|
bad += 1
|
||||||
|
badmap[depRepo.GoPath] = err
|
||||||
} else {
|
} else {
|
||||||
log.Info("downloaded", depRepo.GoPath)
|
log.Info("downloaded", depRepo.GoPath)
|
||||||
good += 1
|
good += 1
|
||||||
|
@ -118,6 +121,9 @@ func recursiveClone(check *gitpb.Repo) error {
|
||||||
}
|
}
|
||||||
log.Info("got", good, "repos", "failed on", bad, "repos")
|
log.Info("got", good, "repos", "failed on", bad, "repos")
|
||||||
if bad != 0 {
|
if bad != 0 {
|
||||||
|
for gopath, err := range badmap {
|
||||||
|
log.Info("clone() error", gopath, err)
|
||||||
|
}
|
||||||
return errors.New("clone failed on some repos")
|
return errors.New("clone failed on some repos")
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go.wit.com/lib/gui/shell"
|
||||||
|
"go.wit.com/log"
|
||||||
|
)
|
||||||
|
|
||||||
|
func gitPull() {
|
||||||
|
log.Info("Total repositories:", forge.Repos.Len())
|
||||||
|
log.Info("Going to run git pull in each one. TODO: use rill here")
|
||||||
|
pull := []string{"git", "pull"}
|
||||||
|
|
||||||
|
var trycount, errcount int
|
||||||
|
repos := forge.Repos.SortByGoPath()
|
||||||
|
for repos.Scan() {
|
||||||
|
repo := repos.Next()
|
||||||
|
if argv.DryRun {
|
||||||
|
log.Info("git pull --dry-run", repo.GoPath)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
log.Info("git pull:", repo.FullPath)
|
||||||
|
trycount += 1
|
||||||
|
log.Info("actually run: git pull:", repo.GoPath)
|
||||||
|
if result := shell.PathRunRealtime(repo.FullPath, pull); result.Error != nil {
|
||||||
|
log.Info("git pull error:", result.Error)
|
||||||
|
errcount += 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.Info("Total repositories:", forge.Repos.Len(), "Total attempted:", trycount, "Errors:", errcount)
|
||||||
|
}
|
56
main.go
56
main.go
|
@ -4,7 +4,6 @@ import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"go.wit.com/dev/alexflint/arg"
|
"go.wit.com/dev/alexflint/arg"
|
||||||
"go.wit.com/lib/gui/shell"
|
|
||||||
"go.wit.com/lib/protobuf/forgepb"
|
"go.wit.com/lib/protobuf/forgepb"
|
||||||
"go.wit.com/lib/protobuf/gitpb"
|
"go.wit.com/lib/protobuf/gitpb"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
|
@ -86,58 +85,3 @@ func badExit(err error) {
|
||||||
log.Info("Finished go-clone with error", err, forge.GetGoSrc())
|
log.Info("Finished go-clone with error", err, forge.GetGoSrc())
|
||||||
os.Exit(-1)
|
os.Exit(-1)
|
||||||
}
|
}
|
||||||
|
|
||||||
func gitPull() {
|
|
||||||
log.Info("Total repositories:", forge.Repos.Len())
|
|
||||||
log.Info("Going to run git pull in each one. TODO: use rill here")
|
|
||||||
pull := []string{"git", "pull"}
|
|
||||||
|
|
||||||
var trycount, errcount int
|
|
||||||
repos := forge.Repos.SortByGoPath()
|
|
||||||
for repos.Scan() {
|
|
||||||
repo := repos.Next()
|
|
||||||
if argv.DryRun {
|
|
||||||
log.Info("git pull --dry-run", repo.GoPath)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
log.Info("git pull:", repo.FullPath)
|
|
||||||
trycount += 1
|
|
||||||
log.Info("actually run: git pull:", repo.GoPath)
|
|
||||||
if result := shell.PathRunRealtime(repo.FullPath, pull); result.Error != nil {
|
|
||||||
log.Info("git pull error:", result.Error)
|
|
||||||
errcount += 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
log.Info("Total repositories:", forge.Repos.Len(), "Total attempted:", trycount, "Errors:", errcount)
|
|
||||||
}
|
|
||||||
|
|
||||||
func build() error {
|
|
||||||
err := forge.Build(workingRepo, nil)
|
|
||||||
pwd, _ := os.Getwd()
|
|
||||||
if err == nil {
|
|
||||||
log.Info("this totally worked", pwd)
|
|
||||||
shell.RunEcho([]string{"ls", "-l"})
|
|
||||||
log.Info("ran ls")
|
|
||||||
} else {
|
|
||||||
log.Info("this totally did not work", pwd)
|
|
||||||
shell.RunEcho([]string{"ls", "-l"})
|
|
||||||
log.Info("ran ls")
|
|
||||||
badExit(err)
|
|
||||||
}
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
func autoWork() {
|
|
||||||
// remake the go.work file
|
|
||||||
if argv.AutoWork {
|
|
||||||
log.Info("About to re-create", forge.GetGoSrc()+"/go.work")
|
|
||||||
shell.PathRun(forge.GetGoSrc(), []string{"mv", "go.work", "go.work.last"})
|
|
||||||
forge.MakeGoWork()
|
|
||||||
shell.PathRun(forge.GetGoSrc(), []string{"go", "work", "use"})
|
|
||||||
log.Info("")
|
|
||||||
log.Info("original go.work file saved as go.work.last")
|
|
||||||
log.Info("")
|
|
||||||
okExit("go.work create")
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go.wit.com/lib/gui/shell"
|
||||||
|
"go.wit.com/log"
|
||||||
|
)
|
||||||
|
|
||||||
|
func autoWork() {
|
||||||
|
// remake the go.work file
|
||||||
|
if !argv.AutoWork {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
log.Info("About to re-create", forge.GetGoSrc()+"/go.work")
|
||||||
|
shell.PathRun(forge.GetGoSrc(), []string{"mv", "go.work", "go.work.last"})
|
||||||
|
forge.MakeGoWork()
|
||||||
|
shell.PathRun(forge.GetGoSrc(), []string{"go", "work", "use"})
|
||||||
|
log.Info("")
|
||||||
|
log.Info("original go.work file saved as go.work.last")
|
||||||
|
log.Info("")
|
||||||
|
}
|
Loading…
Reference in New Issue