Reduce number of excludes in golangci-lint
This issue will track the open tasks to reduce the number of excludes in our golangci-lint config
Tasks:
- [ ] https://github.com/kubernetes-sigs/cluster-api/issues/12272
- [x] Migrate away from client.Apply:
client.Apply is deprecated: Use client.Client.Apply - [ ] Let's audit all exclude rules and check which ones we can drop or match more precisely on the findings
/triage accepted
Regarding
Migrate away from client.Apply: client.Apply is deprecated: Use client.Client.Apply
I could see only in few tests files client.Client is implicitly declared to satisfy the Client interface, Like https://github.com/kubernetes-sigs/cluster-api/blob/b46a303451e9acd9bf59f634ad468631ba6b2d0c/cmd/clusterctl/client/cluster/crd_migration_test.go#L241.
Where else do I need to check to fix this? Is there any way I can reproduce this warning locally.
@Karthik-K-N You can remove the exclude and run make lint
@Karthik-K-N You can remove the exclude and run
make lint
Thanks you, Still I could not able to rightly identify whats the right way of replace client.Apply is Patch commands.(May be to create patch object with RawPatch) may be will explore a bit or it would be handy if you have any other pointers or expectations. Thank you.
Sure, no problem. Here is an example with Unstructured. I think for now we should/can probably only replace Patch calls with Unstructured
old
err = r.Client.Patch(ctx, u, client.Apply, client.FieldOwner("crdmigrator"))
new
err = r.Client.Apply(ctx, client.ApplyConfigurationFromUnstructured(u), client.FieldOwner("crdmigrator"))
@sivchari I think "Migrate away from GetEventRecorder" once #13159 merges could be an interesting one for you