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

@@ -127,7 +127,7 @@ func TestMultiZoneBlockConfigs(t *testing.T) {
server *caddy.Instance
err error
)
for j := 0; j < 3; j++ {
for j := range 3 {
corefile := `.:%d .:%d .:%d {
debug
}`
@@ -150,7 +150,7 @@ func TestMultiZoneBlockConfigs(t *testing.T) {
configs := reflect.ValueOf(ctxVal2.Interface()).Elem().FieldByName("configs")
configs2 := reflect.NewAt(configs.Type(), unsafe.Pointer(configs.UnsafeAddr())).Elem()
for i := 0; i < 3; i++ {
for i := range 3 {
v := configs2.Index(i)
config := v.Interface().(*dnsserver.Config)
if !config.Debug {