0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-12-23 03:04:17 +01:00
gitea/services/pull
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>
2023-10-06 14:49:37 +08:00
..
check.go More refactoring of db.DefaultContext (#27083) 2023-09-15 06:13:19 +00:00
check_test.go
comment.go
commit_status.go
edits.go
lfs.go
main_test.go make writing main test easier (#27270) 2023-09-28 01:38:53 +00:00
merge.go Move notification interface to services layer (#26915) 2023-09-05 18:37:47 +00:00
merge_merge.go
merge_prepare.go
merge_rebase.go
merge_squash.go
merge_test.go
patch.go
patch_unmerged.go
pull.go Remove redundant len check around loop (#27464) 2023-10-06 14:49:37 +08:00
pull_test.go
review.go Even more db.DefaultContext refactor (#27352) 2023-10-03 10:30:41 +00:00
temp_repo.go
update.go
update_rebase.go