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

linter for unused function return value #842

Open
sharnoff opened this issue Mar 4, 2024 · 1 comment
Open

linter for unused function return value #842

sharnoff opened this issue Mar 4, 2024 · 1 comment
Labels
a/reliability Area: relates to reliability of the service

Comments

@sharnoff
Copy link
Member

sharnoff commented Mar 4, 2024

Problem description / Motivation

As an example, #807 was caused by failing to call .Inc() on the prometheus.Counter returned by WithLabelValues(...).

It'd be good to have automated checking of this to reduce the impact of making a similar mistake in the future.

Feature idea(s) / DoD

DoD: we have a linter as part of the lints workflow that would have caught #807. Consider handling other common types as well.

Implementation ideas

I briefly searched for such a linter, but couldn't find any.

@shayanh
Copy link
Contributor

shayanh commented Mar 5, 2024

There should be some I think. I know either VSCode or Goland shows you a warning if you ignore return values from a function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a/reliability Area: relates to reliability of the service
Projects
None yet
Development

No branches or pull requests

2 participants