mirror of
https://github.com/go-gitea/gitea
synced 2025-07-26 12:18:36 +00:00
Enable gocritic equalFold
and fix issues (#34952)
Continuation of https://github.com/go-gitea/gitea/pull/34678. --------- Signed-off-by: silverwind <me@silverwind.io>
This commit is contained in:
@@ -12,8 +12,7 @@ import (
|
||||
// SliceContainsString sequential searches if string exists in slice.
|
||||
func SliceContainsString(slice []string, target string, insensitive ...bool) bool {
|
||||
if len(insensitive) != 0 && insensitive[0] {
|
||||
target = strings.ToLower(target)
|
||||
return slices.ContainsFunc(slice, func(t string) bool { return strings.ToLower(t) == target })
|
||||
return slices.ContainsFunc(slice, func(t string) bool { return strings.EqualFold(t, target) })
|
||||
}
|
||||
|
||||
return slices.Contains(slice, target)
|
||||
|
@@ -59,7 +59,7 @@ func TimeEstimateParse(timeStr string) (int64, error) {
|
||||
unit := timeStr[match[4]:match[5]]
|
||||
found := false
|
||||
for _, u := range timeStrGlobalVars().units {
|
||||
if strings.ToLower(unit) == u.name {
|
||||
if strings.EqualFold(unit, u.name) {
|
||||
total += amount * u.num
|
||||
found = true
|
||||
break
|
||||
|
Reference in New Issue
Block a user