You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While working on #967, we realized that the breaking change could have been anticipated since the webhook interfaces were already marked as deprecated. However, golangci did not detect this.
Expected Behavior
golangci should terminate with an error if deprecated code is used.
Steps To Reproduce
No response
Environment
Anything else?
No response
The text was updated successfully, but these errors were encountered:
There is no problem in our golinter configuration. The staticcheck linter is running and is able to detect deprecated code. I've tests adding deprecated comment in the vendor directory. For example, I've added the comment in the Add function in the Manager interface of the controller-runtime package. I can see this linter errors after that:
/home/jvanz/SUSE/kubewarden-controller/bin/golangci-lint-v1.60.3 runWARN The linter 'exportloopref' is deprecated (since v1.60.2) due to: Since Go1.22 (loopvar) this linter is no longer relevant. Replaced by copyloopvar. internal/controller/cert_controller.go:60:12: SA1019: mgr.Add is deprecated: testing. (staticcheck) if err := mgr.Add(r); err != nil { ^
Than, I've discovered that the linter is not able to notify us about the deprecated types because the comment is not properly done. The deprecated comment should be in a seperated paragraph in the comments. In other words, it's:
// Defaulter defines functions for setting defaults on resources.// Deprecated: Use CustomDefaulter instead.
But it should be:
// Defaulter defines functions for setting defaults on resources.//// Deprecated: Use CustomDefaulter instead.
After this change I can see the following linter errors:
api/policies/v1/admissionpolicy_webhook.go:48:7: SA1019: webhook.Defaulter is deprecated: Use CustomDefaulter instead. (staticcheck)var _ webhook.Defaulter = &AdmissionPolicy{} ^api/policies/v1/admissionpolicygroup_webhook.go:48:7: SA1019: webhook.Defaulter is deprecated: Use CustomDefaulter instead. (staticcheck)var _ webhook.Defaulter = &AdmissionPolicyGroup{} ^api/policies/v1/clusteradmissionpolicy_webhook.go:51:7: SA1019: webhook.Defaulter is deprecated: Use CustomDefaulter instead. (staticcheck)var _ webhook.Defaulter = &ClusterAdmissionPolicy{} ^api/policies/v1/clusteradmissionpolicygroup_webhook.go:50:7: SA1019: webhook.Defaulter is deprecated: Use CustomDefaulter instead. (staticcheck)var _ webhook.Defaulter = &ClusterAdmissionPolicyGroup{} ^api/policies/v1/policyserver_webhook.go:53:7: SA1019: webhook.Defaulter is deprecated: Use CustomDefaulter instead. (staticcheck)var _ webhook.Defaulter = &PolicyServer{}
Is there an existing issue for this?
Current Behavior
While working on #967, we realized that the breaking change could have been anticipated since the webhook interfaces were already marked as deprecated. However, golangci did not detect this.
Expected Behavior
golangci should terminate with an error if deprecated code is used.
Steps To Reproduce
No response
Environment
Anything else?
No response
The text was updated successfully, but these errors were encountered: