Skip to content
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

Merged
merged 2 commits into from
Nov 26, 2024

Conversation

ShyamsundarR
Copy link
Member

No description provided.

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
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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

Copy link
Member Author

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{}
Copy link
Member

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.

@nirs nirs self-requested a review November 25, 2024 15:27
@ShyamsundarR ShyamsundarR merged commit dba0d4c into RamenDR:main Nov 26, 2024
22 checks passed
@ShyamsundarR ShyamsundarR deleted the linter-1 branch November 26, 2024 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants