Skip to content

Commit

Permalink
Remove nolint annotations for unix errno comparisons
Browse files Browse the repository at this point in the history
golangci-lint v1.54.2 comes with errorlint v1.4.4, which contains
the fix [1] whitelisting all errno comparisons for errors coming from
x/sys/unix. Thus, these annotations are no longer necessary. Remove
those.

Except, the errors that do not come directly from a function in unix
package still need to be annotated (see [2]).

[1] polyfloyd/go-errorlint#47
[2] polyfloyd/go-errorlint#55
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
  • Loading branch information
kolyshkin committed Aug 25, 2023
1 parent b809725 commit 5ab22c5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions go-selinux/selinux_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func verifySELinuxfsMount(mnt string) bool {
if err == nil {
break
}
if err == unix.EAGAIN || err == unix.EINTR { //nolint:errorlint // unix errors are bare
if err == unix.EAGAIN || err == unix.EINTR {
continue
}
return false
Expand Down Expand Up @@ -263,7 +263,7 @@ func isProcHandle(fh *os.File) error {
if err == nil {
break
}
if err != unix.EINTR { //nolint:errorlint // unix errors are bare
if err != unix.EINTR {
return &os.PathError{Op: "fstatfs", Path: fh.Name(), Err: err}
}
}
Expand Down Expand Up @@ -328,7 +328,7 @@ func lSetFileLabel(fpath string, label string) error {
if err == nil {
break
}
if err != unix.EINTR { //nolint:errorlint // unix errors are bare
if err != unix.EINTR {
return &os.PathError{Op: "lsetxattr", Path: fpath, Err: err}
}
}
Expand All @@ -347,7 +347,7 @@ func setFileLabel(fpath string, label string) error {
if err == nil {
break
}
if err != unix.EINTR { //nolint:errorlint // unix errors are bare
if err != unix.EINTR {
return &os.PathError{Op: "setxattr", Path: fpath, Err: err}
}
}
Expand Down
4 changes: 2 additions & 2 deletions go-selinux/xattrs_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func lgetxattr(path, attr string) ([]byte, error) {
func doLgetxattr(path, attr string, dest []byte) (int, error) {
for {
sz, err := unix.Lgetxattr(path, attr, dest)
if err != unix.EINTR { //nolint:errorlint // unix errors are bare
if err != unix.EINTR {
return sz, err
}
}
Expand Down Expand Up @@ -64,7 +64,7 @@ func getxattr(path, attr string) ([]byte, error) {
func dogetxattr(path, attr string, dest []byte) (int, error) {
for {
sz, err := unix.Getxattr(path, attr, dest)
if err != unix.EINTR { //nolint:errorlint // unix errors are bare
if err != unix.EINTR {
return sz, err
}
}
Expand Down

0 comments on commit 5ab22c5

Please sign in to comment.