Lint common error wrapping issues, update README#1969
Merged
helsaawy merged 2 commits intomicrosoft:mainfrom Dec 11, 2023
Merged
Lint common error wrapping issues, update README#1969helsaawy merged 2 commits intomicrosoft:mainfrom
helsaawy merged 2 commits intomicrosoft:mainfrom
Conversation
anmaxvl
approved these changes
Nov 17, 2023
Enable `errorlint` to catch common issues with wrapping and testing for errors. Wherever possible, switched to using `errors.Is` and `errors.As`. Exceptions: - function is defined in the same package and explicitly returns a know error variable - returns from functions in `io`, `binary`, `context`, `syscall`, `golang.org/x/sys/windows`, or `golang.org/x/sys/unix` that are (relatively) stable in error return value and type - conversion would interact with with `github.com/pkg/errors` - conversion would be non-trivial and require additional testing/validation - specifically, legacy code in `runhcs` and the root of the repo Rename `context` to `ctx` in `pkg\go-runhcs\*.go` to avoid overshadowing `context` package. Update `README.md`: - run markdown formatter (spaces around code blocks and headers, raw link URLS) - add section on linter and go generate (similar to go-winio's) Signed-off-by: Hamza El-Saawy <[email protected]>
katiewasnothere
approved these changes
Dec 8, 2023
Signed-off-by: Hamza El-Saawy <[email protected]>
katiewasnothere
approved these changes
Dec 11, 2023
princepereira
pushed a commit
to princepereira/hcsshim
that referenced
this pull request
Aug 28, 2024
* Lint common error wrapping issues, update README Enable `errorlint` to catch common issues with wrapping and testing for errors. Wherever possible, switched to using `errors.Is` and `errors.As`. Exceptions: - function is defined in the same package and explicitly returns a know error variable - returns from functions in `io`, `binary`, `context`, `syscall`, `golang.org/x/sys/windows`, or `golang.org/x/sys/unix` that are (relatively) stable in error return value and type - conversion would interact with with `github.com/pkg/errors` - conversion would be non-trivial and require additional testing/validation - specifically, legacy code in `runhcs` and the root of the repo Rename `context` to `ctx` in `pkg\go-runhcs\*.go` to avoid overshadowing `context` package. Update `README.md`: - run markdown formatter (spaces around code blocks and headers, raw link URLS) - add section on linter and go generate (similar to go-winio's) Signed-off-by: Hamza El-Saawy <[email protected]> * PR: hcserrors(+tests), README Signed-off-by: Hamza El-Saawy <[email protected]> --------- Signed-off-by: Hamza El-Saawy <[email protected]>
princepereira
pushed a commit
to princepereira/hcsshim
that referenced
this pull request
Aug 29, 2024
* Lint common error wrapping issues, update README Enable `errorlint` to catch common issues with wrapping and testing for errors. Wherever possible, switched to using `errors.Is` and `errors.As`. Exceptions: - function is defined in the same package and explicitly returns a know error variable - returns from functions in `io`, `binary`, `context`, `syscall`, `golang.org/x/sys/windows`, or `golang.org/x/sys/unix` that are (relatively) stable in error return value and type - conversion would interact with with `github.com/pkg/errors` - conversion would be non-trivial and require additional testing/validation - specifically, legacy code in `runhcs` and the root of the repo Rename `context` to `ctx` in `pkg\go-runhcs\*.go` to avoid overshadowing `context` package. Update `README.md`: - run markdown formatter (spaces around code blocks and headers, raw link URLS) - add section on linter and go generate (similar to go-winio's) Signed-off-by: Hamza El-Saawy <[email protected]> * PR: hcserrors(+tests), README Signed-off-by: Hamza El-Saawy <[email protected]> --------- Signed-off-by: Hamza El-Saawy <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enable
errorlintto catch common issues with wrapping and testing for errors.Wherever possible, switched to using
errors.Isanderrors.As. Exceptions:io,binary,context,syscall,golang.org/x/sys/windows, orgolang.org/x/sys/unixthat are (relatively) stable in error return value and typegithub.com/pkg/errorsrunhcsand the root of the repoRename
contexttoctxinpkg\go-runhcs\*.goto avoid overshadowingcontextpackage.Update
README.md: