-
Notifications
You must be signed in to change notification settings - Fork 379
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
CI: enable errorlint #2512
CI: enable errorlint #2512
Commits on Aug 10, 2024
-
copy.Image: improve wrapping Close errors
When commit 849dd70 was written, Go did not have an ability to wrap multiple errors. Since Go 1.20 it's possible by either using multiple %w, or via errors.Join (which discards nil errors). In a sense, this is what the code was doing before commit 849dd70, except we don't add extra spaces or parentheses -- as joined error, when converted to a string, is represented with newlines added between elements. Signed-off-by: Kir Kolyshkin <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 7092582 - Browse repository at this point
Copy the full SHA 7092582View commit details -
pkg/blobcache: simplify test case
1. Use os.ReadDir to remove a few lines of code. 2. Don't wrap errors from os, they already contain file name. Signed-off-by: Kir Kolyshkin <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 1d4025f - Browse repository at this point
Copy the full SHA 1d4025fView commit details -
1. Don't add context (such as file name and operation) to errors from "os" as they already have this information. 2. Use %w for errors, including multiple errors (works Go 1.20). Signed-off-by: Kir Kolyshkin <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for aa038a5 - Browse repository at this point
Copy the full SHA aa038a5View commit details -
This needs to be "require" rather than "assert", as if error is returned, test needs to fail now. Otherwise, close will panic. Signed-off-by: Kir Kolyshkin <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 61852e6 - Browse repository at this point
Copy the full SHA 61852e6View commit details -
directory: simplify newImageDestination
The current code is unnecessarily complicated: - check if a file/directory exists before opening it unnecessary; - it uses three helper functions not used anywhere else; - directory contents is read twice. Untangle all this, making the code simpler. Signed-off-by: Kir Kolyshkin <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for c7da673 - Browse repository at this point
Copy the full SHA c7da673View commit details -
sig/int: simplify error conversion
Use errors.As to convert errors. Move the code that converts JSONFormatError to NewInvalidSignatureError to a separate helper, and use it everywhere. Remove the intermediary functions where they became unnecessary. Signed-off-by: Kir Kolyshkin <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 1adc5c4 - Browse repository at this point
Copy the full SHA 1adc5c4View commit details -
Enable errorlint, ignore some warnings
This enables errorlint to golangci-lint configuration, and silences last warnings found (three of these are to be removed once a new version of errorlint will be used). Signed-off-by: Kir Kolyshkin <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 2f691ef - Browse repository at this point
Copy the full SHA 2f691efView commit details