You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Eng Zer Jun 13d5d2e711
Remove redundant `len` check around loop (#27464)
This pull request is a minor code cleanup.

From the Go specification (https://go.dev/ref/spec#For_range):

> "1. For a nil slice, the number of iterations is 0."
> "3. If the map is nil, the number of iterations is 0."

`len` returns 0 if the slice or map is nil
(https://pkg.go.dev/builtin#len). Therefore, checking `len(v) > 0`
before a loop is unnecessary.

---

At the time of writing this pull request, there wasn't a lint rule that
catches these issues. The closest I could find is
https://staticcheck.dev/docs/checks/#S103

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
9 months ago
..
check.go More refactoring of `db.DefaultContext` (#27083) 10 months ago
check_test.go Add context parameter to some database functions (#26055) 11 months ago
comment.go Delete `issue_service.CreateComment` (#26298) 11 months ago
commit_status.go Fix pull request check list is limited (#26179) 11 months ago
edits.go Implement FSFE REUSE for golang files (#21840) 2 years ago
lfs.go Refactor and tidy-up the merge/update branch code (#22568) 1 year ago
main_test.go make writing main test easier (#27270) 9 months ago
merge.go Move notification interface to services layer (#26915) 10 months ago
merge_merge.go Refactor and tidy-up the merge/update branch code (#22568) 1 year ago
merge_prepare.go Refactor merge/update git command calls (#23366) 1 year ago
merge_rebase.go Merge message template support for rebase without merge commit (#22669) 1 year ago
merge_squash.go Improve squash merge commit author and co-author with private emails (#22977) 1 year ago
merge_test.go Support template for merge message description (#22248) 2 years ago
patch.go Add transaction when creating pull request created dirty data (#26259) 11 months ago
patch_unmerged.go Implement FSFE REUSE for golang files (#21840) 2 years ago
pull.go Remove redundant `len` check around loop (#27464) 9 months ago
pull_test.go Support template for merge message description (#22248) 2 years ago
review.go Even more `db.DefaultContext` refactor (#27352) 9 months ago
temp_repo.go Sync branches into databases (#22743) 1 year ago
update.go Sync branches into databases (#22743) 1 year ago
update_rebase.go Refactor and tidy-up the merge/update branch code (#22568) 1 year ago