lint: enable prealloc (#7493)

This commit is contained in:
Ville Vesilehto
2025-09-02 04:05:15 +03:00
committed by GitHub
parent 4d3061a9c4
commit 359632a2f4
5 changed files with 8 additions and 6 deletions

View File

@@ -224,8 +224,10 @@ func (k *Kubernetes) ExternalReverse(ip string) ([]msg.Service, error) {
}
func (k *Kubernetes) serviceRecordForExternalIP(ip string) []msg.Service {
var svcs []msg.Service
for _, service := range k.APIConn.SvcExtIndexReverse(ip) {
svcList := k.APIConn.SvcExtIndexReverse(ip)
svcLen := len(svcList)
svcs := make([]msg.Service, 0, svcLen)
for _, service := range svcList {
if len(k.Namespaces) > 0 && !k.namespaceExposed(service.Namespace) {
continue
}

View File

@@ -257,8 +257,7 @@ func emitAddressRecord(c chan<- []dns.RR, s msg.Service) string {
// calcSRVWeight borrows the logic implemented in plugin.SRV for dynamically
// calculating the srv weight and priority
func calcSRVWeight(numservices int) uint16 {
var services []msg.Service
services := make([]msg.Service, 0, numservices)
for range numservices {
services = append(services, msg.Service{})
}