Skip to content

Commit 4b206d7

Browse files
stubbiclaude
andcommitted
style: preallocate allowedHostnames slice (lint: prealloc)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 90d657a commit 4b206d7

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

internal/resources/statefulset.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -536,15 +536,17 @@ func buildAuthEmailAndOAuthEnvVars(instance *paperclipv1alpha1.Instance) []corev
536536
func allowedHostnames(instance *paperclipv1alpha1.Instance) []string {
537537
svc := ServiceName(instance)
538538
ns := instance.Namespace
539-
hosts := []string{
539+
extra := instance.Spec.Deployment.AllowedHostnames
540+
hosts := make([]string, 0, 6+len(extra))
541+
hosts = append(hosts,
540542
"localhost",
541543
"127.0.0.1",
542544
svc,
543-
svc + "." + ns,
544-
svc + "." + ns + ".svc",
545-
svc + "." + ns + ".svc.cluster.local",
546-
}
547-
hosts = append(hosts, instance.Spec.Deployment.AllowedHostnames...)
545+
svc+"."+ns,
546+
svc+"."+ns+".svc",
547+
svc+"."+ns+".svc.cluster.local",
548+
)
549+
hosts = append(hosts, extra...)
548550

549551
seen := make(map[string]bool, len(hosts))
550552
out := make([]string, 0, len(hosts))

0 commit comments

Comments
 (0)