diff --git a/main.go b/main.go index 28cf6ac..9e2d3d6 100644 --- a/main.go +++ b/main.go @@ -47,6 +47,9 @@ func main() { log.Info("yep, need to clone", argv.Repo) } else { log.Info("already have", argv.Repo) + if argv.Recursive { + recursiveClone() + } build() okExit(argv.Repo) } @@ -173,31 +176,34 @@ func gitPull() { log.Info("Total repositories:", forge.Repos.Len(), "Total attempted:", trycount, "Errors:", errcount) } +// really only does go.sum things +// so not 'really' recursive +// but that is because go.sum is supposed +// to have everything required in it func recursiveClone() { + var good int + var bad int // this works sometimes if argv.Recursive { - newr := rv.FindByName(argv.Repo) - if newr == nil { - log.Info("how did this repo still not exist?", argv.Repo) - badExit(errors.New("failed to clone repo: " + argv.Repo)) - } - os.Setenv("REPO_AUTO_CLONE", "true") - godep := newr.Status.GetGoDeps() - for gopath, version := range godep { - pb, err := forge.Clone(gopath) + check := forge.Repos.FindByGoPath(argv.Repo) + + log.Info("download deps for:", check.GoPath) + deps := check.GoDeps.SortByGoPath() + for deps.Scan() { + depRepo := deps.Next() + log.Info("download:", depRepo.GoPath) + _, err := forge.Clone(depRepo.GoPath) if err != nil { - log.Info("could not download") - badExit(err) + log.Info("could not download", depRepo.GoPath) + log.Info("err:", err) + bad += 1 + } else { + log.Info("downloaded", depRepo.GoPath) + good += 1 } - repo, err := rv.AddRepo(pb) - if err != nil { - log.Info("git clone failed for", gopath, version) - continue - } - // always do this for now. probably always forever - repo.MakeRedoMod() } } + log.Info("got", good, "repos", "failed on", bad, "repos") } func redoGoModAll() {