still smarter
This commit is contained in:
parent
7265c0d6a1
commit
4bbf8c76bc
|
@ -8,6 +8,7 @@ import (
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"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"
|
||||||
|
@ -18,8 +19,8 @@ import (
|
||||||
// checks to see if every 'master' git branch version
|
// checks to see if every 'master' git branch version
|
||||||
// matches the go.sum file
|
// matches the go.sum file
|
||||||
func cleanGoDepsCheckOk(check *gitpb.Repo) error {
|
func cleanGoDepsCheckOk(check *gitpb.Repo) error {
|
||||||
var err error = nil
|
// var err error = nil
|
||||||
var fixes [][]string
|
// var fixes [][]string
|
||||||
log.Printf("current repo %s go dependancy count: %d", check.GetGoPath(), check.GoDepsLen())
|
log.Printf("current repo %s go dependancy count: %d", check.GetGoPath(), check.GoDepsLen())
|
||||||
if check.GoDeps == nil {
|
if check.GoDeps == nil {
|
||||||
return errors.New("check.GoDeps == nil")
|
return errors.New("check.GoDeps == nil")
|
||||||
|
@ -34,8 +35,7 @@ func cleanGoDepsCheckOk(check *gitpb.Repo) error {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
log.Info("not found:", depRepo.GetGoPath())
|
log.Info("not found:", depRepo.GetGoPath())
|
||||||
err = errors.New("not found: " + depRepo.GetGoPath())
|
return errors.New("not found: " + depRepo.GetGoPath())
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
// log.Info("found dep", depRepo.GetGoPath())
|
// log.Info("found dep", depRepo.GetGoPath())
|
||||||
if depRepo.GetVersion() != found.GetMasterVersion() {
|
if depRepo.GetVersion() != found.GetMasterVersion() {
|
||||||
|
@ -68,18 +68,23 @@ func cleanGoDepsCheckOk(check *gitpb.Repo) error {
|
||||||
if ok, _ := forgepb.ValidGoVersion(found.GetMasterVersion()); ok {
|
if ok, _ := forgepb.ValidGoVersion(found.GetMasterVersion()); ok {
|
||||||
// can't go get invalid version numbers
|
// can't go get invalid version numbers
|
||||||
cmd := []string{"go", "get", depRepo.GetGoPath() + "@" + found.GetMasterVersion()}
|
cmd := []string{"go", "get", depRepo.GetGoPath() + "@" + found.GetMasterVersion()}
|
||||||
fixes = append(fixes, cmd)
|
// fixes = append(fixes, cmd)
|
||||||
|
if _, err := shell.RunVerbose(cmd); err != nil {
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
err = errors.New(errs)
|
} else {
|
||||||
|
return errors.New(errs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
for i, cmd := range fixes {
|
for i, cmd := range fixes {
|
||||||
log.Info("try cmd", i, cmd)
|
log.Info("try cmd", i, cmd)
|
||||||
check.RunRealtime(cmd)
|
|
||||||
}
|
}
|
||||||
return err
|
*/
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func trimGoSum(check *gitpb.Repo) error {
|
func trimGoSum(check *gitpb.Repo) error {
|
||||||
|
@ -103,6 +108,10 @@ func trimGoSum(check *gitpb.Repo) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, line := range strings.Split(string(data), "\n") {
|
for _, line := range strings.Split(string(data), "\n") {
|
||||||
|
line = strings.TrimSpace(line)
|
||||||
|
if line == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
parts := strings.Fields(line)
|
parts := strings.Fields(line)
|
||||||
if len(parts) < 3 {
|
if len(parts) < 3 {
|
||||||
log.Info("WIERD OR BAD:", line)
|
log.Info("WIERD OR BAD:", line)
|
||||||
|
|
|
@ -38,9 +38,11 @@ func doSmart(repo *gitpb.Repo) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
log.Info(repo.GetGoPath(), "the files were restored with redoGoMod()")
|
log.Info(repo.GetGoPath(), "the files were restored with redoGoMod()")
|
||||||
|
/*
|
||||||
if repo.Exists("go.mod") {
|
if repo.Exists("go.mod") {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// the first time, it'll attempt to fix some stuff
|
// the first time, it'll attempt to fix some stuff
|
||||||
if err := cleanGoDepsCheckOk(repo); err != nil {
|
if err := cleanGoDepsCheckOk(repo); err != nil {
|
||||||
|
|
Loading…
Reference in New Issue