autofix: fix check for empty string (#6804)

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
This commit is contained in:
deepsource-autofix[bot]
2022-03-06 16:33:45 +08:00
committed by GitHub
parent 65526f84e1
commit deec3516d5
39 changed files with 82 additions and 86 deletions

View File

@@ -38,7 +38,7 @@ func Home(c *context.Context) {
// Check auto-login.
uname := c.GetCookie(conf.Security.CookieUsername)
if len(uname) != 0 {
if uname != "" {
c.Redirect(conf.Server.Subpath + "/user/login")
return
}
@@ -104,7 +104,7 @@ func RenderUserSearch(c *context.Context, opts *UserSearchOptions) {
)
keyword := c.Query("q")
if len(keyword) == 0 {
if keyword == "" {
users, err = opts.Ranger(page, opts.PageSize)
if err != nil {
c.Error(err, "ranger")