diff --git a/models/issue_label.go b/models/issue_label.go index ab6c4731eee..bf61fcaeca3 100644 --- a/models/issue_label.go +++ b/models/issue_label.go @@ -134,7 +134,7 @@ func NewLabels(labels ...*Label) error { // If pass repoID as 0, then ORM will ignore limitation of repository // and can return arbitrary label with any valid ID. func getLabelInRepoByName(e Engine, repoID int64, labelName string) (*Label, error) { - if len(labelName) <= 0 { + if len(labelName) == 0 { return nil, ErrLabelNotExist{0, repoID} } diff --git a/models/org.go b/models/org.go index 1cc25231e61..c0a4172dc52 100644 --- a/models/org.go +++ b/models/org.go @@ -677,7 +677,7 @@ func (env *accessibleReposEnv) Repos(page, pageSize int) ([]*Repository, error) } repos := make([]*Repository, 0, len(repoIDs)) - if len(repoIDs) <= 0 { + if len(repoIDs) == 0 { return repos, nil } @@ -705,7 +705,7 @@ func (env *accessibleReposEnv) MirrorRepos() ([]*Repository, error) { } repos := make([]*Repository, 0, len(repoIDs)) - if len(repoIDs) <= 0 { + if len(repoIDs) == 0 { return repos, nil } diff --git a/models/ssh_key.go b/models/ssh_key.go index c2836e6885d..2592209b4d7 100644 --- a/models/ssh_key.go +++ b/models/ssh_key.go @@ -376,7 +376,7 @@ func calcFingerprint(publicKeyContent string) (string, error) { } func addKey(e Engine, key *PublicKey) (err error) { - if len(key.Fingerprint) <= 0 { + if len(key.Fingerprint) == 0 { key.Fingerprint, err = calcFingerprint(key.Content) if err != nil { return err diff --git a/modules/auth/auth.go b/modules/auth/auth.go index 8391e7de8f9..0d703084da0 100644 --- a/modules/auth/auth.go +++ b/modules/auth/auth.go @@ -36,7 +36,7 @@ func SignedInID(ctx *macaron.Context, sess session.Store) int64 { // Check access token. if IsAPIPath(ctx.Req.URL.Path) { tokenSHA := ctx.Query("token") - if len(tokenSHA) <= 0 { + if len(tokenSHA) == 0 { tokenSHA = ctx.Query("access_token") } if len(tokenSHA) == 0 { diff --git a/modules/user/user_test.go b/modules/user/user_test.go index 51f10dbbd23..ae7460281fc 100644 --- a/modules/user/user_test.go +++ b/modules/user/user_test.go @@ -18,7 +18,7 @@ func getWhoamiOutput() (string, error) { func TestCurrentUsername(t *testing.T) { user := CurrentUsername() - if len(user) <= 0 { + if len(user) == 0 { t.Errorf("expected non-empty user, got: %s", user) } // Windows whoami is weird, so just skip remaining tests diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index 23a85759c2f..3a539f6ce78 100644 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -80,7 +80,7 @@ import ( func sudo() macaron.Handler { return func(ctx *context.APIContext) { sudo := ctx.Query("sudo") - if len(sudo) <= 0 { + if len(sudo) == 0 { sudo = ctx.Req.Header.Get("Sudo") } diff --git a/routers/user/home.go b/routers/user/home.go index 0c84b2498e0..cbab5c83503 100644 --- a/routers/user/home.go +++ b/routers/user/home.go @@ -213,7 +213,7 @@ func Issues(ctx *context.Context) { return } } - if len(userRepoIDs) <= 0 { + if len(userRepoIDs) == 0 { userRepoIDs = []int64{-1} }