Skip to content

Commit

Permalink
models: break out of loops (go-gitea#12159)
Browse files Browse the repository at this point in the history
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
  • Loading branch information
2 people authored and Yohann Delafollye committed Jul 31, 2020
1 parent b06bdba commit c3fb904
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions models/repo_sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,13 @@ func SignInitialCommit(repoPath string, u *User) (bool, string, error) {
return false, "", &ErrWontSign{noKey}
}

Loop:
for _, rule := range rules {
switch rule {
case never:
return false, "", &ErrWontSign{never}
case always:
break
break Loop
case pubkey:
keys, err := ListGPGKeys(u.ID, ListOptions{})
if err != nil {
Expand Down Expand Up @@ -138,12 +139,13 @@ func (repo *Repository) SignWikiCommit(u *User) (bool, string, error) {
return false, "", &ErrWontSign{noKey}
}

Loop:
for _, rule := range rules {
switch rule {
case never:
return false, "", &ErrWontSign{never}
case always:
break
break Loop
case pubkey:
keys, err := ListGPGKeys(u.ID, ListOptions{})
if err != nil {
Expand Down Expand Up @@ -190,12 +192,13 @@ func (repo *Repository) SignCRUDAction(u *User, tmpBasePath, parentCommit string
return false, "", &ErrWontSign{noKey}
}

Loop:
for _, rule := range rules {
switch rule {
case never:
return false, "", &ErrWontSign{never}
case always:
break
break Loop
case pubkey:
keys, err := ListGPGKeys(u.ID, ListOptions{})
if err != nil {
Expand Down

0 comments on commit c3fb904

Please sign in to comment.