-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linters: Bring back removed linters: wastedassign #1672
Conversation
Signed-off-by: Shyamsundar Ranganathan <[email protected]>
exhaustruct is also in the disabled list, so this is just a cleanup of the commented linter Signed-off-by: Shyamsundar Ranganathan <[email protected]>
@@ -566,7 +566,7 @@ func GetDRClusters(ctx context.Context, client client.Client, drPolicy *rmn.DRPo | |||
func (r DRPlacementControlReconciler) updateObjectMetadata(ctx context.Context, | |||
drpc *rmn.DRPlacementControl, placementObj client.Object, log logr.Logger, | |||
) error { | |||
update := false | |||
var update bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the issue with the previous code? Both are valid Go code and should compile to the same thing. If not this should be a Go compiler bug.
Maybe we need to report a golangci-lint bug for this, the linter should not requiring changing such code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a wasted assignment as it is overwritten right after. The linter is for a code practice not a code error afaict. I do not see an issue with the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is already an issue this:
sanposhiho/wastedassign#39
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I did visit that issue, once addressed it may help. For now it is better to have the linter than not, so I suggest we do not wait for a resolution of that issue (which seems to be 2+ years old).
s3SecretRef := corev1.SecretReference{Name: secretName, Namespace: secretNS} | ||
object := &runtime.RawExtension{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we replace pointer to object with nil - this makes sense if the intent of the code is to initialize the pointer only in some cases, so a good change.
No description provided.