Pass files to golint one at a time#67675
Conversation
|
/cc @nikhita Still need to write stuff up on this one, but figured I might as well throw it in front of CI while I grab some lunch. |
hack/verify-golint.sh
Outdated
There was a problem hiding this comment.
@cblecker thank you!
This line looks good. If CI likes it overall, lgtm with an update to the comment. 👍
|
/cc @spxtr |
|
This is what the failures look like now that it's actually looking at all files: |
hack/verify-golint.sh
Outdated
There was a problem hiding this comment.
Can we add some more details on why a package might contain a fatal error? Something like: as if one file in the package contains a fatal error due to the presence of a corresponding foo_test package.
The foo_test line in the script helped me find the problem in a second. :)
hack/verify-golint.sh
Outdated
|
Adding some more details so that if someone comes across this, it's easier for them to understand the line of thought. :)
This is due to an existing golint bug: golang/lint#68 (comment). If we lint a package using and skips the linting. Current behaviour was to ignore this error, which also meant that we ignored the linting of these packages all together. Also, it's not possible to lint the whole package together through
And so we use xargs to make sure we are linting all files and don't hit any errors. ✨ |
|
@nikhita Addressed your feedback. PTAL! Also thanks for the amazing write up ✨ 🗒 ! I linked to this PR in the comments to so future bash spelunkers will be able to find it! :bash: |
🎉 /lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cblecker, nikhita The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Automatic merge from submit-queue (batch tested with PRs 67378, 67675, 67654). If you want to cherry-pick this change to another branch, please follow the instructions here. |
What this PR does / why we need it:
When we pass multiple files into golint at once, and golint detects a fatal error in one of them, it will actually exit and not process any more of the files passed. For large packages, this increases the chance that golint will exit.
This change will, instead of golinting once per package, will use xargs to run each file through golint individually.
Special notes for your reviewer:
Out of interest, I timed the difference between using find and a regex to exclude the generated files, but
ls | grepwas about 15-20 seconds faster throughout the entire duration of the run (about 2 minutes).Release note: