refactor: replace Split in loops with more efficient SplitSeq

Signed-off-by: vicerace <vicerace@sohu.com>
This commit is contained in:
vicerace 2025-11-25 18:24:18 +08:00
parent 957383c708
commit b0dc4952e2
2 changed files with 3 additions and 3 deletions

View file

@ -11,7 +11,7 @@ import (
// parseCommaSeparatedValues parses comma separated string into a map.
func parseCommaSeparatedValues(values string) FilterValues {
m := make(FilterValues)
for _, v := range strings.Split(values, ",") {
for v := range strings.SplitSeq(values, ",") {
v = strings.TrimSpace(v)
if len(v) == 0 {
continue

View file

@ -22,8 +22,8 @@ func IsDomain(d string) bool {
if IsLocalSuffix(d) {
return false
}
parts := strings.Split(d, ".")
for _, p := range parts {
parts := strings.SplitSeq(d, ".")
for p := range parts {
if !IsLabel(p) {
return false
}