Functions from the golang.org/x/sys/unix package wraps its error, always returning bare errno, and so it's OK to use direct error comparison.
Example:
err := unix.Rmdir(path)
if err == nil || err == unix.ENOENT {
return nil
}
On the above code, the linter says:
comparing with == will fail on wrapped errors. Use errors.Is to check for a specific error (errorlint)
For a package that uses a lot of unix functions, it's a burden to annotate all such code as the above example with //nolint:errorlint // unix errors are bare, but this is exactly what I had to do in runc: opencontainers/runc@56e4780
Surely, the alternative is to switch to errors.Is(err, unix.ENOENT) and the like, but in the particular case it seems redudnant.
Would be nice to have comparison linter to add an exclusion for errors returned from golang.org/x/sys/unix.* functions.