Skip to content

Commit

Permalink
return false instead of break (#271)
Browse files Browse the repository at this point in the history
  • Loading branch information
cooperspencer authored Sep 4, 2024
1 parent 818c0ce commit 9e1217e
Showing 1 changed file with 12 additions and 24 deletions.
36 changes: 12 additions & 24 deletions local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func Locally(repo types.Repo, l types.Local, dry bool) bool {
if err = os.MkdirAll(l.Path, 0o777); err != nil {
sub.Error().
Msg(err.Error())

return false
}

Expand All @@ -72,6 +73,7 @@ func Locally(repo types.Repo, l types.Local, dry bool) bool {
if err != nil {
sub.Error().
Msg(err.Error())

return false
}

Expand All @@ -90,6 +92,7 @@ func Locally(repo types.Repo, l types.Local, dry bool) bool {
if err != nil {
sub.Error().
Msg(err.Error())

return false
}
case repo.Token != "":
Expand Down Expand Up @@ -122,22 +125,23 @@ func Locally(repo types.Repo, l types.Local, dry bool) bool {
sub.Warn().
Str("repo", repo.Name).
Msg(err.Error())
break

return false
}
if x == tries {
sub.Warn().
Str("repo", repo.Name).
Msg(err.Error())

break
return false
}

if strings.Contains(err.Error(), "ERR access denied or repository not exported") {
sub.Warn().
Str("repo", repo.Name).
Msgf("%s doesn't exist.", repo.Name)

break
return false
}

if strings.Contains(err.Error(), "remote repository is empty") {
Expand Down Expand Up @@ -184,31 +188,13 @@ func Locally(repo types.Repo, l types.Local, dry bool) bool {
sub.Warn().
Str("repo", repo.Name).
Msg(err.Error())
/*
err = os.RemoveAll(filepath.Join(l.Path, repo.Name))
if err != nil {
dir, _ := filepath.Abs(filepath.Join(l.Path, repo.Name))
sub.Warn().
Str("repo", repo.Name).Err(err).
Msgf("couldn't remove %s", types.Red(dir))
}
*/
break

return false
} else {
sub.Warn().
Str("repo", repo.Name).Err(err).
Msgf("retry %s from %s", types.Red(x), types.Red(tries))

/*
err = os.RemoveAll(filepath.Join(l.Path, repo.Name))
if err != nil {
dir, _ := filepath.Abs(filepath.Join(l.Path, repo.Name))
sub.Warn().
Str("repo", repo.Name).Err(err).
Msgf("couldn't remove %s", types.Red(dir))
}
*/

time.Sleep(5 * time.Second)

continue
Expand Down Expand Up @@ -268,6 +254,7 @@ func Locally(repo types.Repo, l types.Local, dry bool) bool {
sub.Error().
Str("repo", repo.Name).
Msg(err.Error())

return false
}

Expand All @@ -279,7 +266,8 @@ func Locally(repo types.Repo, l types.Local, dry bool) bool {
if err != nil {
sub.Warn().
Str("repo", repo.Name).Msg(err.Error())
break

return false
}

keep := []string{}
Expand Down

0 comments on commit 9e1217e

Please sign in to comment.