Skip to content

Commit d6afeb8

Browse files
committed
bump golangci-lint to v1.56.1
1 parent c9a40d3 commit d6afeb8

File tree

109 files changed

+232
-232
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+232
-232
lines changed

.github/workflows/pr-golangci-lint.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ jobs:
3030
- name: golangci-lint
3131
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # tag=v3.7.0
3232
with:
33-
version: v1.55.2
33+
version: v1.56.1
3434
args: --out-format=colored-line-number
3535
working-directory: ${{matrix.working-directory}}

bootstrap/kubeadm/api/v1beta1/kubeadm_types.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ func (bts *BootstrapTokenString) UnmarshalJSON(b []byte) error {
569569

570570
// String returns the string representation of the BootstrapTokenString.
571571
func (bts BootstrapTokenString) String() string {
572-
if len(bts.ID) > 0 && len(bts.Secret) > 0 {
572+
if bts.ID != "" && bts.Secret != "" {
573573
return bootstraputil.TokenFromIDAndSecret(bts.ID, bts.Secret)
574574
}
575575
return ""

bootstrap/kubeadm/api/v1beta1/kubeadm_types_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ func roundtrip(input string, bts *BootstrapTokenString) error {
156156
var err error
157157
newbts := &BootstrapTokenString{}
158158
// If string input was specified, roundtrip like this: string -> (unmarshal) -> object -> (marshal) -> string
159-
if len(input) > 0 {
159+
if input != "" {
160160
if err := json.Unmarshal([]byte(input), newbts); err != nil {
161161
return errors.Wrap(err, "expected no unmarshal error, got error")
162162
}

bootstrap/kubeadm/internal/controllers/kubeadmconfig_controller_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ func TestKubeadmConfigReconciler_TestSecretOwnerReferenceReconciliation(t *testi
179179
key := client.ObjectKeyFromObject(config)
180180
actual := &corev1.Secret{}
181181

182-
t.Run("KubeadmConfig ownerReference is added on first reconcile", func(t *testing.T) {
182+
t.Run("KubeadmConfig ownerReference is added on first reconcile", func(*testing.T) {
183183
_, err = k.Reconcile(ctx, request)
184184
g.Expect(err).ToNot(HaveOccurred())
185185

@@ -191,7 +191,7 @@ func TestKubeadmConfigReconciler_TestSecretOwnerReferenceReconciliation(t *testi
191191
g.Expect(controllerOwner.Name).To(Equal(config.Name))
192192
})
193193

194-
t.Run("KubeadmConfig ownerReference re-reconciled without error", func(t *testing.T) {
194+
t.Run("KubeadmConfig ownerReference re-reconciled without error", func(*testing.T) {
195195
_, err = k.Reconcile(ctx, request)
196196
g.Expect(err).ToNot(HaveOccurred())
197197

@@ -202,7 +202,7 @@ func TestKubeadmConfigReconciler_TestSecretOwnerReferenceReconciliation(t *testi
202202
g.Expect(controllerOwner.Kind).To(Equal(config.Kind))
203203
g.Expect(controllerOwner.Name).To(Equal(config.Name))
204204
})
205-
t.Run("non-KubeadmConfig controller OwnerReference is replaced", func(t *testing.T) {
205+
t.Run("non-KubeadmConfig controller OwnerReference is replaced", func(*testing.T) {
206206
g.Expect(myclient.Get(ctx, key, actual)).To(Succeed())
207207

208208
actual.SetOwnerReferences([]metav1.OwnerReference{
@@ -741,7 +741,7 @@ func TestReconcileIfJoinNodePoolsAndControlPlaneIsReady(t *testing.T) {
741741
name: "Join a worker node with a fully compiled kubeadm config object",
742742
machinePool: newWorkerMachinePoolForCluster(cluster),
743743
configName: "workerpool-join-cfg",
744-
configBuilder: func(namespace, name string) *bootstrapv1.KubeadmConfig {
744+
configBuilder: func(namespace, _ string) *bootstrapv1.KubeadmConfig {
745745
return newWorkerJoinKubeadmConfig(namespace, "workerpool-join-cfg")
746746
},
747747
},

bootstrap/kubeadm/internal/controllers/suite_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ var (
3636
)
3737

3838
func TestMain(m *testing.M) {
39-
setupReconcilers := func(ctx context.Context, mgr ctrl.Manager) {
39+
setupReconcilers := func(_ context.Context, mgr ctrl.Manager) {
4040
var err error
4141
secretCachingClient, err = client.New(mgr.GetConfig(), client.Options{
4242
HTTPClient: mgr.GetHTTPClient(),

bootstrap/kubeadm/internal/locking/control_plane_init_mutex_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ func TestControlPlaneInitMutex_LockWithMachineDeletion(t *testing.T) {
176176
},
177177
}
178178
for _, tc := range tests {
179-
t.Run(tc.name, func(t *testing.T) {
179+
t.Run(tc.name, func(*testing.T) {
180180
l := &ControlPlaneInitMutex{
181181
client: tc.client,
182182
}

bootstrap/kubeadm/types/upstreamv1beta2/bootstraptokenstring.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func (bts *BootstrapTokenString) UnmarshalJSON(b []byte) error {
6262

6363
// String returns the string representation of the BootstrapTokenString.
6464
func (bts BootstrapTokenString) String() string {
65-
if len(bts.ID) > 0 && len(bts.Secret) > 0 {
65+
if bts.ID != "" && bts.Secret != "" {
6666
return bootstraputil.TokenFromIDAndSecret(bts.ID, bts.Secret)
6767
}
6868
return ""

bootstrap/kubeadm/types/upstreamv1beta2/bootstraptokenstring_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func roundtrip(input string, bts *BootstrapTokenString) error {
9898
var err error
9999
newbts := &BootstrapTokenString{}
100100
// If string input was specified, roundtrip like this: string -> (unmarshal) -> object -> (marshal) -> string
101-
if len(input) > 0 {
101+
if input != "" {
102102
if err := json.Unmarshal([]byte(input), newbts); err != nil {
103103
return errors.Wrap(err, "expected no unmarshal error, got error")
104104
}

bootstrap/kubeadm/types/upstreamv1beta3/bootstraptokenstring.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func (bts *BootstrapTokenString) UnmarshalJSON(b []byte) error {
6060

6161
// String returns the string representation of the BootstrapTokenString.
6262
func (bts BootstrapTokenString) String() string {
63-
if len(bts.ID) > 0 && len(bts.Secret) > 0 {
63+
if bts.ID != "" && bts.Secret != "" {
6464
return bootstraputil.TokenFromIDAndSecret(bts.ID, bts.Secret)
6565
}
6666
return ""

bootstrap/kubeadm/types/upstreamv1beta3/bootstraptokenstring_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ func roundtrip(input string, bts *BootstrapTokenString) error {
105105
var err error
106106
newbts := &BootstrapTokenString{}
107107
// If string input was specified, roundtrip like this: string -> (unmarshal) -> object -> (marshal) -> string
108-
if len(input) > 0 {
108+
if input != "" {
109109
if err := json.Unmarshal([]byte(input), newbts); err != nil {
110110
return errors.Wrap(err, "expected no unmarshal error, got error")
111111
}

cmd/clusterctl/client/client_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ func newFakeClient(ctx context.Context, configClient config.Client) *fakeClient
176176
fake.internalClient, _ = newClusterctlClient(ctx, "fake-config",
177177
InjectConfig(fake.configClient),
178178
InjectClusterClientFactory(clusterClientFactory),
179-
InjectRepositoryFactory(func(ctx context.Context, input RepositoryClientFactoryInput) (repository.Client, error) {
179+
InjectRepositoryFactory(func(_ context.Context, input RepositoryClientFactoryInput) (repository.Client, error) {
180180
if _, ok := fake.repositories[input.Provider.ManifestLabel()]; !ok {
181181
return nil, errors.Errorf("repository for kubeconfig %q does not exist", input.Provider.ManifestLabel())
182182
}
@@ -212,14 +212,14 @@ func newFakeCluster(kubeconfig cluster.Kubeconfig, configClient config.Client) *
212212
}
213213

214214
fake.fakeProxy = test.NewFakeProxy()
215-
pollImmediateWaiter := func(ctx context.Context, interval, timeout time.Duration, condition wait.ConditionWithContextFunc) error {
215+
pollImmediateWaiter := func(context.Context, time.Duration, time.Duration, wait.ConditionWithContextFunc) error {
216216
return nil
217217
}
218218

219219
fake.internalclient = cluster.New(kubeconfig, configClient,
220220
cluster.InjectProxy(fake.fakeProxy),
221221
cluster.InjectPollImmediateWaiter(pollImmediateWaiter),
222-
cluster.InjectRepositoryFactory(func(ctx context.Context, provider config.Provider, configClient config.Client, options ...repository.Option) (repository.Client, error) {
222+
cluster.InjectRepositoryFactory(func(_ context.Context, provider config.Provider, _ config.Client, _ ...repository.Option) (repository.Client, error) {
223223
if _, ok := fake.repositories[provider.Name()]; !ok {
224224
return nil, errors.Errorf("repository for kubeconfig %q does not exist", provider.Name())
225225
}

cmd/clusterctl/client/cluster/cert_manager_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func Test_getManifestObjs(t *testing.T) {
129129

130130
cm := &certManagerClient{
131131
configClient: defaultConfigClient,
132-
repositoryClientFactory: func(ctx context.Context, provider config.Provider, configClient config.Client, options ...repository.Option) (repository.Client, error) {
132+
repositoryClientFactory: func(ctx context.Context, provider config.Provider, configClient config.Client, _ ...repository.Option) (repository.Client, error) {
133133
return repository.New(ctx, provider, configClient, repository.InjectRepository(tt.fields.repository))
134134
},
135135
}
@@ -168,7 +168,7 @@ func Test_getManifestObjs(t *testing.T) {
168168
}
169169

170170
func Test_GetTimeout(t *testing.T) {
171-
pollImmediateWaiter := func(ctx context.Context, interval, timeout time.Duration, condition wait.ConditionWithContextFunc) error {
171+
pollImmediateWaiter := func(context.Context, time.Duration, time.Duration, wait.ConditionWithContextFunc) error {
172172
return nil
173173
}
174174

@@ -426,7 +426,7 @@ func Test_shouldUpgrade(t *testing.T) {
426426

427427
proxy := test.NewFakeProxy()
428428
fakeConfigClient := newFakeConfig().WithCertManager("", tt.configVersion, "")
429-
pollImmediateWaiter := func(ctx context.Context, interval, timeout time.Duration, condition wait.ConditionWithContextFunc) error {
429+
pollImmediateWaiter := func(context.Context, time.Duration, time.Duration, wait.ConditionWithContextFunc) error {
430430
return nil
431431
}
432432
cm := newCertManagerClient(fakeConfigClient, nil, proxy, pollImmediateWaiter)
@@ -715,7 +715,7 @@ func Test_certManagerClient_PlanUpgrade(t *testing.T) {
715715

716716
proxy := test.NewFakeProxy().WithObjs(tt.objs...)
717717
fakeConfigClient := newFakeConfig()
718-
pollImmediateWaiter := func(ctx context.Context, interval, timeout time.Duration, condition wait.ConditionWithContextFunc) error {
718+
pollImmediateWaiter := func(context.Context, time.Duration, time.Duration, wait.ConditionWithContextFunc) error {
719719
return nil
720720
}
721721
cm := newCertManagerClient(fakeConfigClient, nil, proxy, pollImmediateWaiter)

cmd/clusterctl/client/cluster/installer_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ func Test_providerInstaller_Validate(t *testing.T) {
245245
configClient: configClient,
246246
proxy: tt.fields.proxy,
247247
providerInventory: newInventoryClient(tt.fields.proxy, nil),
248-
repositoryClientFactory: func(ctx context.Context, provider config.Provider, configClient config.Client, options ...repository.Option) (repository.Client, error) {
248+
repositoryClientFactory: func(ctx context.Context, provider config.Provider, configClient config.Client, _ ...repository.Option) (repository.Client, error) {
249249
return repository.New(ctx, provider, configClient, repository.InjectRepository(repositoryMap[provider.ManifestLabel()]))
250250
},
251251
installQueue: tt.fields.installQueue,

cmd/clusterctl/client/cluster/mover.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ func (o *objectMover) createTargetObject(ctx context.Context, nodeToCreate *node
967967

968968
// FIXME Workaround for https://github.com/kubernetes/kubernetes/issues/32220. Remove when the issue is fixed.
969969
// If the resource already exists, the API server ordinarily returns an AlreadyExists error. Due to the above issue, if the resource has a non-empty metadata.generateName field, the API server returns a ServerTimeoutError. To ensure that the API server returns an AlreadyExists error, we set the metadata.generateName field to an empty string.
970-
if len(obj.GetName()) > 0 && len(obj.GetGenerateName()) > 0 {
970+
if obj.GetName() != "" && obj.GetGenerateName() != "" {
971971
obj.SetGenerateName("")
972972
}
973973

cmd/clusterctl/client/cluster/proxy.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ func (k *proxy) ListResources(ctx context.Context, labels map[string]string, nam
224224
// Get all the API resources in the cluster.
225225
resourceListBackoff := newReadBackoff()
226226
var resourceList []*metav1.APIResourceList
227-
if err := retryWithExponentialBackoff(ctx, resourceListBackoff, func(ctx context.Context) error {
227+
if err := retryWithExponentialBackoff(ctx, resourceListBackoff, func(context.Context) error {
228228
resourceList, err = cs.Discovery().ServerPreferredResources()
229229
return err
230230
}); err != nil {

cmd/clusterctl/client/cluster/template_test.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ func Test_templateClient_getGitHubFileContent(t *testing.T) {
168168
configClient, err := config.New(context.Background(), "", config.InjectReader(test.NewFakeReader()))
169169
g.Expect(err).ToNot(HaveOccurred())
170170

171-
mux.HandleFunc("/repos/kubernetes-sigs/cluster-api/contents/config/default/cluster-template.yaml", func(w http.ResponseWriter, r *http.Request) {
171+
mux.HandleFunc("/repos/kubernetes-sigs/cluster-api/contents/config/default/cluster-template.yaml", func(w http.ResponseWriter, _ *http.Request) {
172172
fmt.Fprint(w, `{
173173
"type": "file",
174174
"encoding": "base64",
@@ -214,7 +214,7 @@ func Test_templateClient_getGitHubFileContent(t *testing.T) {
214214

215215
c := &templateClient{
216216
configClient: configClient,
217-
gitHubClientFactory: func(ctx context.Context, configVariablesClient config.VariablesClient) (*github.Client, error) {
217+
gitHubClientFactory: func(context.Context, config.VariablesClient) (*github.Client, error) {
218218
return client, nil
219219
},
220220
}
@@ -232,7 +232,7 @@ func Test_templateClient_getGitHubFileContent(t *testing.T) {
232232
}
233233

234234
func Test_templateClient_getRawUrlFileContent(t *testing.T) {
235-
fakeServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
235+
fakeServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
236236
fmt.Fprint(w, template)
237237
}))
238238

@@ -343,7 +343,7 @@ func Test_templateClient_GetFromURL(t *testing.T) {
343343
fakeGithubClient, mux, teardown := test.NewFakeGitHub()
344344
defer teardown()
345345

346-
mux.HandleFunc("/repos/kubernetes-sigs/cluster-api/contents/config/default/cluster-template.yaml", func(w http.ResponseWriter, r *http.Request) {
346+
mux.HandleFunc("/repos/kubernetes-sigs/cluster-api/contents/config/default/cluster-template.yaml", func(w http.ResponseWriter, _ *http.Request) {
347347
fmt.Fprint(w, `{
348348
"type": "file",
349349
"encoding": "base64",
@@ -355,7 +355,7 @@ func Test_templateClient_GetFromURL(t *testing.T) {
355355
}`)
356356
})
357357

358-
mux.HandleFunc("/repos/some-owner/some-repo/releases/tags/v1.0.0", func(w http.ResponseWriter, r *http.Request) {
358+
mux.HandleFunc("/repos/some-owner/some-repo/releases/tags/v1.0.0", func(w http.ResponseWriter, _ *http.Request) {
359359
fmt.Fprint(w, `{
360360
"tag_name": "v1.0.0",
361361
"name": "v1.0.0",
@@ -370,11 +370,11 @@ func Test_templateClient_GetFromURL(t *testing.T) {
370370
}`)
371371
})
372372

373-
mux.HandleFunc("/repos/some-owner/some-repo/releases/assets/87654321", func(w http.ResponseWriter, r *http.Request) {
373+
mux.HandleFunc("/repos/some-owner/some-repo/releases/assets/87654321", func(w http.ResponseWriter, _ *http.Request) {
374374
fmt.Fprint(w, template)
375375
})
376376

377-
mux.HandleFunc("/repos/some-owner/some-repo/releases/tags/v2.0.0", func(w http.ResponseWriter, r *http.Request) {
377+
mux.HandleFunc("/repos/some-owner/some-repo/releases/tags/v2.0.0", func(w http.ResponseWriter, _ *http.Request) {
378378
fmt.Fprint(w, `{
379379
"tag_name": "v2.0.0",
380380
"name": "v2.0.0",
@@ -390,14 +390,14 @@ func Test_templateClient_GetFromURL(t *testing.T) {
390390
})
391391

392392
// redirect asset
393-
mux.HandleFunc("/repos/some-owner/some-repo/releases/assets/22222222", func(w http.ResponseWriter, r *http.Request) {
393+
mux.HandleFunc("/repos/some-owner/some-repo/releases/assets/22222222", func(w http.ResponseWriter, _ *http.Request) {
394394
// add the "/api-v3" prefix to match the prefix of the fake github server
395395
w.Header().Add("Location", "/api-v3/redirected/22222222")
396396
w.WriteHeader(http.StatusFound)
397397
})
398398

399399
// redirect location
400-
mux.HandleFunc("/redirected/22222222", func(w http.ResponseWriter, r *http.Request) {
400+
mux.HandleFunc("/redirected/22222222", func(w http.ResponseWriter, _ *http.Request) {
401401
fmt.Fprint(w, template)
402402
})
403403

@@ -488,7 +488,7 @@ func Test_templateClient_GetFromURL(t *testing.T) {
488488

489489
ctx := context.Background()
490490

491-
gitHubClientFactory := func(ctx context.Context, configVariablesClient config.VariablesClient) (*github.Client, error) {
491+
gitHubClientFactory := func(context.Context, config.VariablesClient) (*github.Client, error) {
492492
return fakeGithubClient, nil
493493
}
494494
processor := yaml.NewSimpleProcessor()

cmd/clusterctl/client/cluster/upgrader_info_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ func Test_providerUpgrader_getUpgradeInfo(t *testing.T) {
233233

234234
u := &providerUpgrader{
235235
configClient: configClient,
236-
repositoryClientFactory: func(ctx context.Context, provider config.Provider, configClient config.Client, options ...repository.Option) (repository.Client, error) {
236+
repositoryClientFactory: func(ctx context.Context, provider config.Provider, configClient config.Client, _ ...repository.Option) (repository.Client, error) {
237237
return repository.New(ctx, provider, configClient, repository.InjectRepository(tt.fields.repo))
238238
},
239239
}

cmd/clusterctl/client/cluster/upgrader_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ func Test_providerUpgrader_Plan(t *testing.T) {
315315

316316
u := &providerUpgrader{
317317
configClient: configClient,
318-
repositoryClientFactory: func(ctx context.Context, provider config.Provider, configClient config.Client, options ...repository.Option) (repository.Client, error) {
318+
repositoryClientFactory: func(ctx context.Context, provider config.Provider, configClient config.Client, _ ...repository.Option) (repository.Client, error) {
319319
return repository.New(ctx, provider, configClient, repository.InjectRepository(tt.fields.repository[provider.ManifestLabel()]))
320320
},
321321
providerInventory: newInventoryClient(tt.fields.proxy, nil),
@@ -786,7 +786,7 @@ func Test_providerUpgrader_createCustomPlan(t *testing.T) {
786786

787787
u := &providerUpgrader{
788788
configClient: configClient,
789-
repositoryClientFactory: func(ctx context.Context, provider config.Provider, configClient config.Client, options ...repository.Option) (repository.Client, error) {
789+
repositoryClientFactory: func(ctx context.Context, provider config.Provider, configClient config.Client, _ ...repository.Option) (repository.Client, error) {
790790
return repository.New(ctx, provider, configClient, repository.InjectRepository(tt.fields.repository[provider.Name()]))
791791
},
792792
providerInventory: newInventoryClient(tt.fields.proxy, nil),
@@ -905,7 +905,7 @@ func Test_providerUpgrader_ApplyPlan(t *testing.T) {
905905

906906
u := &providerUpgrader{
907907
configClient: configClient,
908-
repositoryClientFactory: func(ctx context.Context, provider config.Provider, configClient config.Client, options ...repository.Option) (repository.Client, error) {
908+
repositoryClientFactory: func(ctx context.Context, provider config.Provider, configClient config.Client, _ ...repository.Option) (repository.Client, error) {
909909
return repository.New(ctx, provider, configClient, repository.InjectRepository(tt.fields.repository[provider.ManifestLabel()]))
910910
},
911911
providerInventory: newInventoryClient(tt.fields.proxy, nil),
@@ -1046,7 +1046,7 @@ func Test_providerUpgrader_ApplyCustomPlan(t *testing.T) {
10461046

10471047
u := &providerUpgrader{
10481048
configClient: configClient,
1049-
repositoryClientFactory: func(ctx context.Context, provider config.Provider, configClient config.Client, options ...repository.Option) (repository.Client, error) {
1049+
repositoryClientFactory: func(ctx context.Context, provider config.Provider, configClient config.Client, _ ...repository.Option) (repository.Client, error) {
10501050
return repository.New(ctx, provider, configClient, repository.InjectRepository(tt.fields.repository[provider.ManifestLabel()]))
10511051
},
10521052
providerInventory: newInventoryClient(tt.fields.proxy, nil),

cmd/clusterctl/client/config/reader_viper_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@ func Test_viperReader_Init(t *testing.T) {
4949
g.Expect(os.WriteFile(configFileBadContents, []byte("bad-contents"), 0600)).To(Succeed())
5050

5151
// To test the remote config file
52-
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
52+
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
5353
w.Header().Set("Content-Type", "text/plain")
5454
_, err := w.Write([]byte("bar: bar"))
5555
g.Expect(err).ToNot(HaveOccurred())
5656
}))
5757
defer ts.Close()
5858

5959
// To test the remote config file when fails to fetch
60-
tsFail := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
60+
tsFail := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
6161
w.WriteHeader(http.StatusNotFound)
6262
}))
6363
defer tsFail.Close()

cmd/clusterctl/client/config_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ func newFakeClientWithoutCluster(configClient config.Client) *fakeClient {
884884
var err error
885885
fake.internalClient, err = newClusterctlClient(context.Background(), "fake-config",
886886
InjectConfig(fake.configClient),
887-
InjectRepositoryFactory(func(ctx context.Context, input RepositoryClientFactoryInput) (repository.Client, error) {
887+
InjectRepositoryFactory(func(_ context.Context, input RepositoryClientFactoryInput) (repository.Client, error) {
888888
if _, ok := fake.repositories[input.Provider.ManifestLabel()]; !ok {
889889
return nil, errors.Errorf("repository for kubeconfig %q does not exist", input.Provider.ManifestLabel())
890890
}
@@ -1067,7 +1067,7 @@ v3: default3`,
10671067
}
10681068

10691069
for _, tt := range tests {
1070-
t.Run(tt.name, func(t *testing.T) {
1070+
t.Run(tt.name, func(*testing.T) {
10711071
config1 := newFakeConfig(ctx).
10721072
WithProvider(infraProviderConfig)
10731073
cluster1 := newFakeCluster(cluster.Kubeconfig{}, config1)

0 commit comments

Comments
 (0)