lint: enable intrange linter (#7331)

Enable intrange linter to enforce modern Go range syntax over
traditional for loops, by converting:

for i := 0; i < n; i++

to:

for i := range n

Adding type conversions where needed for compatibility
with existing uint64 parameters.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
This commit is contained in:
Ville Vesilehto
2025-05-29 03:50:55 +03:00
committed by GitHub
parent b3acbe5046
commit 19a6ae4983
47 changed files with 82 additions and 81 deletions

View File

@@ -70,7 +70,7 @@ func BenchmarkController(b *testing.B) {
m.SetQuestion("svc1.testns.svc.cluster.local.", dns.TypeA)
b.ResetTimer()
for i := 0; i < b.N; i++ {
for range b.N {
k.ServeDNS(ctx, rw, m)
}
}

View File

@@ -259,7 +259,7 @@ func emitAddressRecord(c chan<- []dns.RR, s msg.Service) string {
func calcSRVWeight(numservices int) uint16 {
var services []msg.Service
for i := 0; i < numservices; i++ {
for range numservices {
services = append(services, msg.Service{})
}