refactor(webhook): iterate hostname labels with SplitSeq (#6251)

This commit is contained in:
elonfliter 2026-08-31 09:04:15 +08:00 committed by GitHub
parent dcef4188db
commit 59541ea438
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -127,7 +127,7 @@ func normalizeHostname(hostname string) (string, error) {
return "", errors.Errorf("hostname must contain between 1 and 253 characters") return "", errors.Errorf("hostname must contain between 1 and 253 characters")
} }
for _, label := range strings.Split(hostname, ".") { for label := range strings.SplitSeq(hostname, ".") {
if label == "" || len(label) > 63 { if label == "" || len(label) > 63 {
return "", errors.Errorf("hostname labels must contain between 1 and 63 characters") return "", errors.Errorf("hostname labels must contain between 1 and 63 characters")
} }