summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Kovalov <iamolegkovalov@gmail.com>2018-10-20 23:25:14 +0200
committertechknowlogick <hello@techknowlogick.com>2018-10-20 17:25:14 -0400
commit5a4648cdd697be92d33be55cd85069365cce2588 (patch)
tree0d246271e482d8d8ffb9f357861c0db5d698064f
parent583b1b84293635633199123ff759849fbd09f7f2 (diff)
downloadgitea-5a4648cdd697be92d33be55cd85069365cce2588.tar.gz
gitea-5a4648cdd697be92d33be55cd85069365cce2588.zip
Remove check for negative length (#5120)
-rw-r--r--models/issue_label.go2
-rw-r--r--models/org.go4
-rw-r--r--models/ssh_key.go2
-rw-r--r--modules/auth/auth.go2
-rw-r--r--modules/user/user_test.go2
-rw-r--r--routers/api/v1/api.go2
-rw-r--r--routers/user/home.go2
7 files changed, 8 insertions, 8 deletions
diff --git a/models/issue_label.go b/models/issue_label.go
index ab6c4731ee..bf61fcaeca 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 1cc25231e6..c0a4172dc5 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 c2836e6885..2592209b4d 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 8391e7de8f..0d703084da 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 51f10dbbd2..ae7460281f 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 23a85759c2..3a539f6ce7 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 0c84b2498e..cbab5c8350 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}
}