fix recursive logic

This commit is contained in:
Jeff Carr 2024-11-17 16:04:08 -06:00
parent c23cc60000
commit b5d3072729
1 changed files with 16 additions and 0 deletions

16
main.go
View File

@ -61,6 +61,9 @@ func main() {
if argv.Recursive || argv.Pull || argv.RedoGoMod { if argv.Recursive || argv.Pull || argv.RedoGoMod {
log.Info("repo already cloned", filepath.Join(wdir, argv.Repo)) log.Info("repo already cloned", filepath.Join(wdir, argv.Repo))
// there is more to do // there is more to do
log.Info("argv.Recursive is", argv.Recursive)
log.Info("argv.Pull is", argv.Pull)
log.Info("argv.RedoGoMod is", argv.RedoGoMod)
log.Info("onward and upward") log.Info("onward and upward")
} else { } else {
log.Info("repo already cloned", filepath.Join(wdir, argv.Repo)) log.Info("repo already cloned", filepath.Join(wdir, argv.Repo))
@ -84,6 +87,17 @@ func main() {
log.Info("could not download:", err) log.Info("could not download:", err)
os.Exit(-1) os.Exit(-1)
} }
if argv.Recursive || argv.Pull || argv.RedoGoMod {
log.Info("repo already cloned", filepath.Join(wdir, argv.Repo))
// there is more to do
log.Info("argv.Recursive is", argv.Recursive)
log.Info("argv.Pull is", argv.Pull)
log.Info("argv.RedoGoMod is", argv.RedoGoMod)
log.Info("onward and upward")
} else {
log.Info("repo cloned worked to", filepath.Join(wdir, argv.Repo))
os.Exit(0)
}
// update go.sum and go.mod // update go.sum and go.mod
// todo: only do this if they don't exist? // todo: only do this if they don't exist?
@ -98,6 +112,7 @@ func main() {
} }
} }
os.Setenv("REPO_AUTO_CLONE", "false")
// look recursively in your working directory for git repos // look recursively in your working directory for git repos
totalcount := scanForRepos(wdir) totalcount := scanForRepos(wdir)
@ -134,6 +149,7 @@ func main() {
log.Info("how did this repo still not exist?", argv.Repo) log.Info("how did this repo still not exist?", argv.Repo)
os.Exit(-1) os.Exit(-1)
} }
os.Setenv("REPO_AUTO_CLONE", "true")
godep := newr.Status.GetGoDeps() godep := newr.Status.GetGoDeps()
for gopath, version := range godep { for gopath, version := range godep {
repo, err := rv.NewRepo(gopath) repo, err := rv.NewRepo(gopath)