selinux
selinux copied to clipboard
golangci-lint: enable more linters and address linting issues
- follow-up to https://github.com/opencontainers/selinux/pull/189
(more coming after this, but I have ETOOMANYBRANCHES already)
I am ok with almost all of these, although I am not crazy about the err:= shadow issue. I find it a lot easier to read
if err := foobar(); err != nil }
Then err := foobar() if err != nil { }
Bottom line, I think err should be handled differently then other shadowed vars. But I am willing to live with the changes.
LGTM
I am not crazy about the
err:=shadow issue.
Yes, I'm slightly on the fence on that one as well;
- in most cases, it's mostly "noise"
- ^^ that said, I'm not against doing a "once in a while" round on changing them
- ^^^ but ... that said; I've also encountered situations where an
errwas masking anerrthat was checked in adefer(). Admitted, those situations are rare (and usually better to have a distinct name for "special" errors).
I don't think the linter itself has a config for this, but perhaps a string match exclusion would work (see https://golangci-lint.run/usage/false-positives/#exclude-issue-by-text)
Tests are failing for go-fumpt?
Tests are failing for go-fumpt?
I probably need to rebase see https://github.com/opencontainers/selinux/pull/189#issuecomment-1277485676
Rebased, and tweaked the settings to ignore "err" for shadowing 👍 PTAL
Oh! Had one more change staged in another branch; just pushed that one as well.
Nice work @thaJeztah