From 94693935052031fe8f28f8d978f29ca04aa84d14 Mon Sep 17 00:00:00 2001 From: Lars Lehtonen Date: Sun, 5 Jul 2020 19:10:02 -0700 Subject: [PATCH] models: break out of loops --- models/repo_sign.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/models/repo_sign.go b/models/repo_sign.go index c728a2911a135..c9dd5ea4dc808 100644 --- a/models/repo_sign.go +++ b/models/repo_sign.go @@ -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 { @@ -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 { @@ -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 {