percona/pmm

Enable `errcheck` linter rule

ademidoff opened this issue · 4 comments

Description

Ref: #1541
We'd like to enable errcheck linter rule.

Suggested solution

  • evaluate if we can afford to enable the rule
  • if yes, fix all linter error to make tests pass
  • if not, disable the rule and leave a comment explaining why (subject to review by the dev team)

Additional context

The rule can be enabled by simply removing this line.
You can check similar PRs to see how we enabled some other rules (ref: #1541)

Code of Conduct

  • I agree to follow this project's Code of Conduct

Hi @atymchuk I would like to work on this issue but i have doubt how do I know that we can afford to enable this linter for example i get linter warning like below
admin/pkg/client/tarball/tarball.go:151:22: Error return value of res.Body.Close is not checked (errcheck)        defer res.Body.Close() //nolint:gosec

hi @atymchuk and @artemgavrilov any update on above ?

Hi @vishwas-sharma2480 , in your particular example I think it makes sense to mute warning with nolint option. But in general every case should be reviewed independently.

Hi @artemgavrilov I have raised another PR can you and team please review it ?