Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add globwalkignorederror linter: flag discarded errors from filepath.Glob/os.ReadDir #51185
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
Uh oh!
There was an error while loading. Please reload this page.
Add globwalkignorederror linter: flag discarded errors from filepath.Glob/os.ReadDir #51185
Changes from all commits
c2e3ad0bb740eeffba5cfFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
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.
The diagnostic message conflates the two different failure modes of
filepath.Globandos.ReadDir:filepath.GlobreturnsErrBadPatternfor malformed glob patterns; filesystem read errors are silently suppressed by design.os.ReadDirreturns filesystem errors but has no pattern concept.The current message
"malformed patterns or unreadable directories silently produce an empty result"is inaccurate for both. Consider per-function messages:@copilot please address 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.
[/grill-with-docs] The diagnostic message conflates the two APIs —
os.ReadDirdoes not involve patterns at all, so "malformed patterns" does not apply to it.💡 Suggested fix
An existing review comment already flags this (id 3738627680). The message should distinguish the two cases, e.g.:
Or keep one message but drop the inaccurate half: "error return from %s.%s is discarded and will silently produce an empty result".
@copilot please address this.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
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.
[/tdd] Missing test case:
os.ReadDirwith a preceding-line(nolint/redacted)comment is not covered.💡 Suggested addition
The
suppressed()function coversfilepath.Globwith a preceding-line nolint andos.ReadDirwith a trailing-line nolint, but notos.ReadDirwith a preceding-line nolint:This confirms the nolint index handles both placement styles for both APIs.
@copilot please address 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.
[/tdd] Off-by-one in the count comment: it jumped from
62to64(adds 2), but this PR adds exactly one analyzer.💡 Fix
The comment on line 93 should read:
The
doc.gobump (63 → 64) is correct. The spec_test comment that previously said62should become63after this PR.@copilot please address this.
Uh oh!
There was an error while loading. Please reload this page.