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

chore: ignore nilerr violations relating to linux process extractor #509

Merged
merged 1 commit into from
Mar 6, 2025

Conversation

G-Rath
Copy link
Collaborator

@G-Rath G-Rath commented Mar 2, 2025

I think my understanding here is correct enough, though I feel like ideally extractSocketInode should be returning a sentinel error rather than 0 (which I assume is being used as it is the sentinel value used by Linux to indicate there isn't an inode); in addition to that requiring a bit more code, I figure it might be possible for the function to end up with 0 anyway meaning we couldn't just get rid of the inode != 0 ...

Ultimately, I'm just looking to get CI green again so happy to go in whatever direction(s) others would prefer (including what's written in the comments)

@@ -94,6 +94,7 @@ func readFileDescriptors(ctx context.Context, d fs.DirEntry, inodesToPID map[int
// only read PID directories
pid, err := strconv.ParseInt(d.Name(), 10, 64)
if err != nil {
//nolint:nilerr // only read PID directories
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd rather remove this lint check, than adding exceptions. I think not passing on the error is totally fine in some cases.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

How do you know though that it is totally fine to be doing so without a comment explaining why it's fine for readers and reviewers? and then, if you're writing a comment to explain that anyway, it doesn't seem costly to prefix that comment with //nolint:nilerr //...

Copy link
Collaborator

@another-rex another-rex left a comment

Choose a reason for hiding this comment

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

Approving to merge this in for now, it seems like a good idea to have the comment there no matter whether we want to keep the lint or not. If we find this to be an issue in the future we can turn it off.

@copybara-service copybara-service bot merged commit d46fab5 into google:main Mar 6, 2025
10 checks passed
@G-Rath G-Rath deleted the chore/disable-lints branch March 6, 2025 01:37
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.

4 participants