mirror of
https://github.com/coredns/coredns.git
synced 2025-10-28 00:34:24 -04:00
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:
@@ -164,7 +164,7 @@ func split255(s string) []string {
|
||||
// targetStrip strips "targetstrip" labels from the left side of the fully qualified name.
|
||||
func targetStrip(name string, targetStrip int) string {
|
||||
offset, end := 0, false
|
||||
for i := 0; i < targetStrip; i++ {
|
||||
for range targetStrip {
|
||||
offset, end = dns.NextLabel(name, offset)
|
||||
}
|
||||
if end {
|
||||
|
||||
@@ -8,7 +8,7 @@ func TestSplit255(t *testing.T) {
|
||||
t.Errorf("Failure to split abc")
|
||||
}
|
||||
s := ""
|
||||
for i := 0; i < 255; i++ {
|
||||
for range 255 {
|
||||
s += "a"
|
||||
}
|
||||
xs = split255(s)
|
||||
@@ -20,7 +20,7 @@ func TestSplit255(t *testing.T) {
|
||||
if len(xs) != 2 || xs[1] != "b" {
|
||||
t.Errorf("Failure to split 256 char long string: %d", len(xs))
|
||||
}
|
||||
for i := 0; i < 255; i++ {
|
||||
for range 255 {
|
||||
s += "a"
|
||||
}
|
||||
xs = split255(s)
|
||||
|
||||
Reference in New Issue
Block a user