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

Address linter issues while moving to golangci version 1.62.0 #1674

Merged
merged 6 commits into from
Nov 26, 2024

Conversation

ShyamsundarR
Copy link
Member

@ShyamsundarR ShyamsundarR commented Nov 23, 2024

This PR moves golangci to 1.62.0 version and addresses issues reported by currently active linters, that are new with the current linter versions.

@ShyamsundarR ShyamsundarR force-pushed the linter-3 branch 2 times, most recently from a2543b5 to cd86bad Compare November 24, 2024 14:11
Copy link
Member

@nirs nirs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to move to latest version, this allows runnign golangci-lint with current go version (1.23).

internal/controller/volumereplicationgroup_controller.go Outdated Show resolved Hide resolved
internal/controller/drplacementcontrol.go Outdated Show resolved Hide resolved
internal/controller/drplacementcontrol.go Outdated Show resolved Hide resolved
@ShyamsundarR
Copy link
Member Author

@nirs other than this comment I assume others are addressed or responded to as it stands. If this is the only one, the I can amend the commit to use the const msg instead and we can get this merged.

As part of moving to golangci 1.62.0, errcheck linter flags off
the code that is modified here as not checking error returns.

This is fixed across the various files to add type safety checks
before accessing the variable.

Signed-off-by: Shyamsundar Ranganathan <[email protected]>
As part of moving to golangci 1.62.0, gosec flags off the mode used
in the code corrected by this commit as too permissive.

The mode is now corrected to be less permissive.

Signed-off-by: Shyamsundar Ranganathan <[email protected]>
@ShyamsundarR
Copy link
Member Author

(latest push above is a rebase of existing contents post merge of #1672 )

Predominant errors were flagged off as:
printf: non-constant format string in call to fmt.Errorf

Signed-off-by: Shyamsundar Ranganathan <[email protected]>
Moving to the latest version errors out on inactivated linters (that were deprecated
earlier). This required commenting out these linters till we ensure we have enabled
the required replacements correctly.

The linters that are inacivated (and hence commented out) are:
deadcode, execinquery, golint, ifshort, maligned, scopelint, strutcheck, varcheck

gomnd is replaced by mnd

exportloopref is replaced by copyloopvar, but not enabled in this commit to address
linter issues in code.

Signed-off-by: Shyamsundar Ranganathan <[email protected]>
@ShyamsundarR ShyamsundarR merged commit b0d4702 into RamenDR:main Nov 26, 2024
22 checks passed
@ShyamsundarR ShyamsundarR deleted the linter-3 branch November 26, 2024 16:34
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.

3 participants