mirror of
https://github.com/kubernetes-sigs/external-dns.git
synced 2025-08-06 01:26:59 +02:00
chore(codebase): enable copyloopvar
This commit is contained in:
parent
718ee660ff
commit
11fd3a87aa
@ -3,6 +3,7 @@ version: "2"
|
||||
linters:
|
||||
default: none
|
||||
enable: # golangci-lint help linters
|
||||
- copyloopvar # A linter detects places where loop variables are copied. https://golangci-lint.run/usage/linters/#copyloopvar
|
||||
- dogsled
|
||||
- goprintffuncname
|
||||
- govet
|
||||
|
@ -223,7 +223,6 @@ func (p *OVHProvider) handleSingleZoneUpdate(ctx context.Context, zoneName strin
|
||||
|
||||
eg, ctxErrGroup := errgroup.WithContext(ctx)
|
||||
for _, change := range allChanges {
|
||||
change := change
|
||||
eg.Go(func() error {
|
||||
return p.change(ctxErrGroup, change)
|
||||
})
|
||||
@ -350,7 +349,6 @@ func (p *OVHProvider) zonesRecords(ctx context.Context) ([]string, []ovhRecord,
|
||||
chRecords := make(chan []ovhRecord, len(zones))
|
||||
eg, ctx := errgroup.WithContext(ctx)
|
||||
for _, zone := range zones {
|
||||
zone := zone
|
||||
eg.Go(func() error { return p.records(ctx, &zone, chRecords) })
|
||||
}
|
||||
if err := eg.Wait(); err != nil {
|
||||
@ -430,7 +428,6 @@ func (p *OVHProvider) records(ctx context.Context, zone *string, records chan<-
|
||||
}
|
||||
chRecords := make(chan ovhRecord, len(recordsIds))
|
||||
for _, id := range recordsIds {
|
||||
id := id
|
||||
eg.Go(func() error { return p.record(ctxErrGroup, zone, id, chRecords) })
|
||||
}
|
||||
if err := eg.Wait(); err != nil {
|
||||
|
@ -32,6 +32,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
fakeDynamic "k8s.io/client-go/dynamic/fake"
|
||||
fakeKube "k8s.io/client-go/kubernetes/fake"
|
||||
|
||||
"sigs.k8s.io/external-dns/endpoint"
|
||||
"sigs.k8s.io/external-dns/source/annotations"
|
||||
)
|
||||
@ -614,7 +615,7 @@ func TestAmbassadorHostSource(t *testing.T) {
|
||||
expected: []*endpoint.Endpoint{},
|
||||
},
|
||||
} {
|
||||
ti := ti
|
||||
|
||||
t.Run(ti.title, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
@ -119,7 +119,7 @@ func testConnectorSourceEndpoints(t *testing.T) {
|
||||
expectError: false,
|
||||
},
|
||||
} {
|
||||
ti := ti
|
||||
|
||||
t.Run(ti.title, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
@ -31,6 +31,7 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
"sigs.k8s.io/external-dns/endpoint"
|
||||
)
|
||||
|
||||
@ -178,7 +179,7 @@ func TestNewContourHTTPProxySource(t *testing.T) {
|
||||
annotationFilter: "contour.heptio.com/ingress.class=contour",
|
||||
},
|
||||
} {
|
||||
ti := ti
|
||||
|
||||
t.Run(ti.title, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@ -282,7 +283,7 @@ func testEndpointsFromHTTPProxy(t *testing.T) {
|
||||
expected: []*endpoint.Endpoint{},
|
||||
},
|
||||
} {
|
||||
ti := ti
|
||||
|
||||
t.Run(ti.title, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@ -1034,7 +1035,7 @@ func testHTTPProxyEndpoints(t *testing.T) {
|
||||
ignoreHostnameAnnotation: true,
|
||||
},
|
||||
} {
|
||||
ti := ti
|
||||
|
||||
t.Run(ti.title, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
@ -468,7 +468,7 @@ func testCRDSourceEndpoints(t *testing.T) {
|
||||
expectError: false,
|
||||
},
|
||||
} {
|
||||
ti := ti
|
||||
|
||||
t.Run(ti.title, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
@ -26,12 +26,13 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
kubefake "k8s.io/client-go/kubernetes/fake"
|
||||
"sigs.k8s.io/external-dns/endpoint"
|
||||
"sigs.k8s.io/external-dns/internal/testutils"
|
||||
"sigs.k8s.io/external-dns/source/annotations"
|
||||
v1 "sigs.k8s.io/gateway-api/apis/v1"
|
||||
v1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1"
|
||||
gatewayfake "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/fake"
|
||||
|
||||
"sigs.k8s.io/external-dns/endpoint"
|
||||
"sigs.k8s.io/external-dns/internal/testutils"
|
||||
"sigs.k8s.io/external-dns/source/annotations"
|
||||
)
|
||||
|
||||
func mustGetLabelSelector(s string) labels.Selector {
|
||||
@ -1581,7 +1582,7 @@ func TestGatewayHTTPRouteSourceEndpoints(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
|
||||
t.Run(tt.title, func(t *testing.T) {
|
||||
if len(tt.logExpectations) == 0 {
|
||||
t.Parallel()
|
||||
|
@ -138,7 +138,7 @@ func TestNewIngressSource(t *testing.T) {
|
||||
annotationFilter: "kubernetes.io/ingress.class=nginx",
|
||||
},
|
||||
} {
|
||||
ti := ti
|
||||
|
||||
t.Run(ti.title, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@ -1424,7 +1424,7 @@ func testIngressEndpoints(t *testing.T) {
|
||||
expected: []*endpoint.Endpoint{},
|
||||
},
|
||||
} {
|
||||
ti := ti
|
||||
|
||||
t.Run(ti.title, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
@ -160,7 +160,7 @@ func TestNewIstioGatewaySource(t *testing.T) {
|
||||
annotationFilter: "kubernetes.io/gateway.class=nginx",
|
||||
},
|
||||
} {
|
||||
ti := ti
|
||||
|
||||
t.Run(ti.title, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@ -492,7 +492,7 @@ func testEndpointsFromGatewayConfig(t *testing.T) {
|
||||
},
|
||||
},
|
||||
} {
|
||||
ti := ti
|
||||
|
||||
t.Run(ti.title, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@ -1473,7 +1473,7 @@ func testGatewayEndpoints(t *testing.T) {
|
||||
expectError: true,
|
||||
},
|
||||
} {
|
||||
ti := ti
|
||||
|
||||
t.Run(ti.title, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
@ -184,7 +184,7 @@ func TestNewIstioVirtualServiceSource(t *testing.T) {
|
||||
annotationFilter: "kubernetes.io/gateway.class=nginx",
|
||||
},
|
||||
} {
|
||||
ti := ti
|
||||
|
||||
t.Run(ti.title, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@ -693,7 +693,7 @@ func testEndpointsFromVirtualServiceConfig(t *testing.T) {
|
||||
},
|
||||
},
|
||||
} {
|
||||
ti := ti
|
||||
|
||||
t.Run(ti.title, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@ -1945,7 +1945,7 @@ func testVirtualServiceEndpoints(t *testing.T) {
|
||||
fqdnTemplate: "{{.Name}}.ext-dns.test.com",
|
||||
},
|
||||
} {
|
||||
ti := ti
|
||||
|
||||
t.Run(ti.title, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
@ -28,6 +28,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
fakeDynamic "k8s.io/client-go/dynamic/fake"
|
||||
fakeKube "k8s.io/client-go/kubernetes/fake"
|
||||
|
||||
"sigs.k8s.io/external-dns/endpoint"
|
||||
)
|
||||
|
||||
@ -342,7 +343,7 @@ func TestKongTCPIngressEndpoints(t *testing.T) {
|
||||
},
|
||||
},
|
||||
} {
|
||||
ti := ti
|
||||
|
||||
t.Run(ti.title, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
@ -73,7 +73,7 @@ func testMultiSourceEndpoints(t *testing.T) {
|
||||
[]*endpoint.Endpoint{foo, bar},
|
||||
},
|
||||
} {
|
||||
tc := tc
|
||||
|
||||
t.Run(tc.title, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
@ -22,6 +22,7 @@ import (
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/sirupsen/logrus/hooks/test"
|
||||
|
||||
"sigs.k8s.io/external-dns/internal/testutils"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
@ -77,7 +78,7 @@ func testNodeSourceNewNodeSource(t *testing.T) {
|
||||
annotationFilter: "kubernetes.io/ingress.class=nginx",
|
||||
},
|
||||
} {
|
||||
ti := ti
|
||||
|
||||
t.Run(ti.title, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
@ -136,7 +136,7 @@ func testOcpRouteSourceNewOcpRouteSource(t *testing.T) {
|
||||
labelFilter: "app=web-external",
|
||||
},
|
||||
} {
|
||||
ti := ti
|
||||
|
||||
labelSelector, err := labels.Parse(ti.labelFilter)
|
||||
require.NoError(t, err)
|
||||
t.Run(ti.title, func(t *testing.T) {
|
||||
@ -516,7 +516,7 @@ func testOcpRouteSourceEndpoints(t *testing.T) {
|
||||
expected: []*endpoint.Endpoint{},
|
||||
},
|
||||
} {
|
||||
tc := tc
|
||||
|
||||
t.Run(tc.title, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
// Create a Kubernetes testing client
|
||||
|
@ -23,6 +23,7 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"sigs.k8s.io/external-dns/endpoint"
|
||||
|
||||
"k8s.io/client-go/kubernetes/fake"
|
||||
@ -599,7 +600,7 @@ func TestPodSource(t *testing.T) {
|
||||
},
|
||||
},
|
||||
} {
|
||||
tc := tc
|
||||
|
||||
t.Run(tc.title, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
@ -145,7 +145,7 @@ func testServiceSourceNewServiceSource(t *testing.T) {
|
||||
serviceTypesFilter: []string{string(v1.ServiceTypeClusterIP)},
|
||||
},
|
||||
} {
|
||||
ti := ti
|
||||
|
||||
t.Run(ti.title, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@ -1074,7 +1074,7 @@ func testServiceSourceEndpoints(t *testing.T) {
|
||||
},
|
||||
},
|
||||
} {
|
||||
tc := tc
|
||||
|
||||
t.Run(tc.title, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@ -1303,7 +1303,7 @@ func testMultipleServicesEndpoints(t *testing.T) {
|
||||
false,
|
||||
},
|
||||
} {
|
||||
tc := tc
|
||||
|
||||
t.Run(tc.title, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@ -1611,7 +1611,7 @@ func TestClusterIpServices(t *testing.T) {
|
||||
expected: []*endpoint.Endpoint{},
|
||||
},
|
||||
} {
|
||||
tc := tc
|
||||
|
||||
t.Run(tc.title, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@ -2303,7 +2303,7 @@ func TestServiceSourceNodePortServices(t *testing.T) {
|
||||
}},
|
||||
},
|
||||
} {
|
||||
tc := tc
|
||||
|
||||
t.Run(tc.title, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@ -3079,7 +3079,7 @@ func TestHeadlessServices(t *testing.T) {
|
||||
false,
|
||||
},
|
||||
} {
|
||||
tc := tc
|
||||
|
||||
t.Run(tc.title, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@ -3548,7 +3548,7 @@ func TestHeadlessServicesHostIP(t *testing.T) {
|
||||
false,
|
||||
},
|
||||
} {
|
||||
tc := tc
|
||||
|
||||
t.Run(tc.title, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@ -3777,7 +3777,7 @@ func TestExternalServices(t *testing.T) {
|
||||
false,
|
||||
},
|
||||
} {
|
||||
tc := tc
|
||||
|
||||
t.Run(tc.title, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
@ -131,7 +131,7 @@ func TestTargetFilterSourceEndpoints(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
|
||||
t.Run(tt.title, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
@ -32,6 +32,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
fakeDynamic "k8s.io/client-go/dynamic/fake"
|
||||
fakeKube "k8s.io/client-go/kubernetes/fake"
|
||||
|
||||
"sigs.k8s.io/external-dns/endpoint"
|
||||
)
|
||||
|
||||
@ -328,7 +329,7 @@ func TestTraefikProxyIngressRouteEndpoints(t *testing.T) {
|
||||
expected: nil,
|
||||
},
|
||||
} {
|
||||
ti := ti
|
||||
|
||||
t.Run(ti.title, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@ -622,7 +623,7 @@ func TestTraefikProxyIngressRouteTCPEndpoints(t *testing.T) {
|
||||
expected: nil,
|
||||
},
|
||||
} {
|
||||
ti := ti
|
||||
|
||||
t.Run(ti.title, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@ -764,7 +765,7 @@ func TestTraefikProxyIngressRouteUDPEndpoints(t *testing.T) {
|
||||
expected: nil,
|
||||
},
|
||||
} {
|
||||
ti := ti
|
||||
|
||||
t.Run(ti.title, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@ -1094,7 +1095,7 @@ func TestTraefikProxyOldIngressRouteEndpoints(t *testing.T) {
|
||||
expected: nil,
|
||||
},
|
||||
} {
|
||||
ti := ti
|
||||
|
||||
t.Run(ti.title, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@ -1388,7 +1389,7 @@ func TestTraefikProxyOldIngressRouteTCPEndpoints(t *testing.T) {
|
||||
expected: nil,
|
||||
},
|
||||
} {
|
||||
ti := ti
|
||||
|
||||
t.Run(ti.title, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@ -1530,7 +1531,7 @@ func TestTraefikProxyOldIngressRouteUDPEndpoints(t *testing.T) {
|
||||
expected: nil,
|
||||
},
|
||||
} {
|
||||
ti := ti
|
||||
|
||||
t.Run(ti.title, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@ -1693,7 +1694,7 @@ func TestTraefikAPIGroupDisableFlags(t *testing.T) {
|
||||
disableNew: true,
|
||||
},
|
||||
} {
|
||||
ti := ti
|
||||
|
||||
t.Run(ti.title, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user