I started working on a Golang project (from my work). The following pattern makes the company configured linter to complain with:
sloppyReassign: re-assignment to `err` can be replaced with `err := myFunc2()` (gocritic)
func myFunc() error {
...
blah, err := getBlah()
if err != nil {
return err
}
...
if err = myFunc2; err != nil {
return err
}
...
}
What bothers me the most is the fact that if I listen to the linter and change the code according to its suggestion I get another complaint saying that I should use the if short version.
Yes, I have found silenced sloppyReassign following this pattern.
What do you think? What linter complaint should I mute? I don't like the idea of a code base polluted with instructions to tell the linter to shut up. Do you think I should suggest stopping using linters? :)
Thank you!