-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow bare errors from golang.org/x/sys/unix #47
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
Thanks for reminding me of this. I have since #10 written another linter that is able to get the full module path. I'll see if I can replicate that here. If that turns out to be not possible, then I propose we merge your proposal. There will probably not a lot of Go packages named |
Ah! I did it. Allowed errors and functions can now be checked against the full package path. I have pushed some unix error handling to the ignore-unix-err branch. Hope this helps! |
All functions in golang.org/x/sys/unix always return raw errno values, which can be compared directly. There are about 100-130 errors, and about 350 functions in unix package. Listing them separately is hardly an option, so let's ignore all unix.E* errors that come from all functions in unix package. This functionality is made possible thanks to commit cd16050. Add a small test case (we can't really add the whole x/sys/unix under testdata, so use a stub implementation). Fixes: polyfloyd#10 Co-Authored-by: polyfloyd <[email protected]> Signed-off-by: Kir Kolyshkin <[email protected]>
Awesome, I've updated this PR based on your code, PTAL. Since there are 100-130 errors in unix (depending on the GOOS and GOARCH), and about 350 functions that can return those errors, ignoring individual errors from the individual functions is hardly an option. We need a wildcard here. |
Thanks a lot! Tested this PR on github.com/opencontainers/runc, no errors from unix are reported (aside from a single unrelated issue, reported in #49. |
Great, thanks. Good to have this finally fixed :) |
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. Hooray! [1] polyfloyd/go-errorlint#47 Signed-off-by: Kir Kolyshkin <[email protected]>
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. Hooray! [1] polyfloyd/go-errorlint#47 Signed-off-by: Kir Kolyshkin <[email protected]>
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. Remove the annotation that is no longer needed. Unfortunately, switch on a bare unix error (in mountinfo) still needs to be annotated (see [2]). [1] polyfloyd/go-errorlint#47 [2] polyfloyd/go-errorlint#54 Signed-off-by: Kir Kolyshkin <[email protected]>
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 <[email protected]>
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. Remove the annotation that is no longer needed. Unfortunately, switch on a bare unix error (in mountinfo) still needs to be annotated (see [2]). [1] polyfloyd/go-errorlint#47 [2] polyfloyd/go-errorlint#54 Signed-off-by: Kir Kolyshkin <[email protected]>
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. Remove the annotation that is no longer needed. Unfortunately, switch on a bare unix error (in mountinfo) still needs to be annotated (see [2]). [1] polyfloyd/go-errorlint#47 [2] polyfloyd/go-errorlint#54 Signed-off-by: Kir Kolyshkin <[email protected]>
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. Remove the annotation that is no longer needed. Unfortunately, switch on a bare unix error (in mountinfo) still needs to be annotated (see [2]). [1] polyfloyd/go-errorlint#47 [2] polyfloyd/go-errorlint#54 Signed-off-by: Kir Kolyshkin <[email protected]>
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. Hooray! [1] polyfloyd/go-errorlint#47 Signed-off-by: Kir Kolyshkin <[email protected]>
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. Hooray! [1] polyfloyd/go-errorlint#47 Signed-off-by: Kir Kolyshkin <[email protected]>
All functions in golang.org/x/sys/unix always return raw errno values,
which can be compared directly.
There are about 100-130 errors, and about 350 functions in unix package.
Listing them separately is hardly an option, so let's ignore all unix.E*
errors that come from all functions in unix package.
This functionality is made possible thanks to commit cd16050.
Add a small test case (we can't really add the whole x/sys/unix under
testdata, so use a stub implementation).
Fixes: #10