nilerr icon indicating copy to clipboard operation
nilerr copied to clipboard

false positive nilerr warning on unrelated error return?

Open dkegel-fastly opened this issue 2 years ago • 0 comments

Reproduced with golangci-lint version 1.45.2 built from 8bdc4d3 on 2022-03-24T11:49:36Z

Running lint shows this warning:

error is not nil (line 51) but it returns nil (nilerr)

on a closed-source function like this:

 func foo() (err error) {
    ...
    query, qerr = url.QueryUnescape(query)
    if qerr != nil {
              return nil
    }
    ...
}

nilerr seems to be convinced that qerr being non-nil means the whole function should return a non-nil error.

I have been unable to extract a minimal case for some reason. Happy to try new versions.

dkegel-fastly avatar Apr 22 '22 02:04 dkegel-fastly