-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
*: fix ineffassign lint #16605
*: fix ineffassign lint #16605
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -442,17 +442,8 @@ function unconvert_pass { | |
run_for_modules generic_checker run_go_tool "github.com/mdempsky/unconvert" unconvert -v | ||
} | ||
|
||
function ineffassign_per_package { | ||
# bash 3.x compatible replacement of: mapfile -t gofiles < <(go_srcs_in_module) | ||
local gofiles=() | ||
while IFS= read -r line; do gofiles+=("$line"); done < <(go_srcs_in_module) | ||
|
||
# TODO: ineffassign should work with package instead of files | ||
run_go_tool github.com/gordonklaus/ineffassign "${gofiles[@]}" | ||
} | ||
|
||
function ineffassign_pass { | ||
run_for_modules generic_checker ineffassign_per_package | ||
run_for_modules generic_checker run_go_tool "github.com/gordonklaus/ineffassign" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's your plan for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. # TODO: https://github.com/etcd-io/etcd/issues/16610
#
# The golangci-lint doesn't verify sub modules. Before #16610 fixed, verify-lint
# still depends on legacy {ineffassign,nakedret,unparam,...}_pass. These X_pass
# will be removed when the golangci-lint covers all the sub modules.
.PHONY: verify-lint
verify-lint: verify-ineffassign
golangci-lint run --config tools/.golangci.yaml I add new recipe There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense, should be good to prevent regressions until we fix golangci. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I assume there is a ticket to track this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. #16610 is tracking this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thx |
||
} | ||
|
||
function nakedret_pass { | ||
|
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.
Shouldn't ineffassign be enabled as part of golangci? Check
tools/.golangci.yaml
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.
Thanks for the reminder! The
tools/.golangci.yaml
already has theineffassign
. But the golangci-lint doesn't support multiple modules so... currently themake verify-lint
doesn't work.May I fix the lint one by one and then fix the
make verify-lint
after that? The small changeset is easy to be reviewed.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.
Oh, that's unfortunate. Fixing golangci sounds good to me. Thanks for investigating this!
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.
After fixing all the lint's issues, I will fix golangci-lint issue.
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.
Can you file an issue about golangci being broken so we can track fixes to lint issues in one place?
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.
Filed #16610 .