refactor: replace Split in loops with more efficient SplitSeq (#6187)

Signed-off-by: questfever <questfever@outlook.com>
This commit is contained in:
questfever 2026-08-16 09:46:16 -04:00 committed by GitHub
parent 14d757ce1f
commit 011a0e8360
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 4 additions and 4 deletions

View file

@ -206,7 +206,7 @@ func parseFullyQualifiedEmoji(data []byte) ([]string, int) {
continue
}
var sequence strings.Builder
for _, field := range strings.Fields(fields[0]) {
for field := range strings.FieldsSeq(fields[0]) {
sequence.WriteRune(parseCodePoint(field))
}
emoji := sequence.String()

View file

@ -219,7 +219,7 @@ func testCookieExpiry() time.Time {
}
func containsCookieAttribute(cookie, attr string) bool {
for _, part := range strings.Split(cookie, ";") {
for part := range strings.SplitSeq(cookie, ";") {
if strings.EqualFold(strings.TrimSpace(part), attr) {
return true
}

View file

@ -198,7 +198,7 @@ func isSecureRequest(ctx context.Context) bool {
}
for _, value := range md.Get("x-forwarded-proto") {
for _, proto := range strings.Split(value, ",") {
for proto := range strings.SplitSeq(value, ",") {
if strings.EqualFold(strings.TrimSpace(proto), "https") {
return true
}

View file

@ -306,7 +306,7 @@ func synthesizeGatewayVariable(segment string) []string {
}
var built []string
for _, part := range strings.Split(subtemplate, "/") {
for part := range strings.SplitSeq(subtemplate, "/") {
switch part {
case "*":
built = append(built, "one")