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!

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAPxFe-utkjMEVrc3DtTR5rmsiEuK8ZLvA6d228PjnroaxRtBkw%40mail.gmail.com.

Reply via email to