Replace Split in loops with more efficient SplitSeq

This commit is contained in:
boqishan
2026-01-15 00:40:07 +08:00
committed by GitHub
parent a6516d36eb
commit 97158ac770
11 changed files with 15 additions and 15 deletions
+2 -2
View File
@@ -245,8 +245,8 @@ func digestParts(resp *http.Response) map[string]string {
result := map[string]string{}
if len(resp.Header["Www-Authenticate"]) > 0 {
wantedHeaders := []string{"nonce", "realm", "qop", "opaque"}
responseHeaders := strings.Split(resp.Header["Www-Authenticate"][0], ",")
for _, r := range responseHeaders {
responseHeaders := strings.SplitSeq(resp.Header["Www-Authenticate"][0], ",")
for r := range responseHeaders {
for _, w := range wantedHeaders {
if strings.Contains(r, w) {
result[w] = strings.Split(r, `"`)[1]
+1 -1
View File
@@ -409,7 +409,7 @@ func (s *BaseSuite) displayTraefikLog(output *bytes.Buffer) {
if output == nil || output.Len() == 0 {
log.Info().Msg("No Traefik logs.")
} else {
for _, line := range strings.Split(output.String(), "\n") {
for line := range strings.SplitSeq(output.String(), "\n") {
log.Info().Msg(line)
}
}