Skip to content

Conversation

mmorel-35
Copy link
Contributor

@mmorel-35 mmorel-35 commented Jul 16, 2025

Description

Enable unused-receiver from revive. It removes names for unused receivers.

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
@@ -19,7 +19,7 @@ import (

// PartitionsWithContext returns disk partition.
// 'all' argument is ignored, see: https://github.com/giampaolo/psutil/issues/906
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like a comment like this one should be provided for all functions you are updating.

Having -withcontext functions that ignore context sounds a bug.

I'm fine with the changes, I understand them. But it's end to something strange.

I feel like a comment like

  • this function complies the interface/signature, unfortunately this os doesn't support context

Copy link
Contributor

Choose a reason for hiding this comment

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

Another way to consider the change would be to check the context and return ctx.Error

Copy link
Contributor

Choose a reason for hiding this comment

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

@mmorel-35 mmorel-35 marked this pull request as ready for review July 16, 2025 07:30
@shirou
Copy link
Owner

shirou commented Jul 20, 2025

Thanks for the PR. I agree that it's certainly possible to remove the variable name definitions. However, as mentioned in the comment, gopsutil needs to use the same function signatures across all platforms. Because of that, it's inevitable that some variables won't be used on certain platforms. I personally think it's better to explicitly use _ to clearly indicate that the variable is unused on that platform.

@mmorel-35
Copy link
Contributor Author

Alright, I'll just drop the second commit then

Copy link
Owner

@shirou shirou left a comment

Choose a reason for hiding this comment

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

OK. thank you for your update.

@shirou shirou merged commit eecb04b into shirou:master Jul 20, 2025
100 checks passed
@mmorel-35 mmorel-35 deleted the revive/unused-receiver branch July 20, 2025 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants