You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The lint "type switch on error will fail on wrapped errors" triggers even when you check the Unwrap interfaces.
Error message
Error: example.go:27:14: type switch on error will fail on wrapped errors. Use errors.As to check for specific errors (errorlint)
switch x := err.(type) {
Bug
The lint "type switch on error will fail on wrapped errors" triggers even when you check the Unwrap interfaces.
Error message
Error: example.go:27:14: type switch on error will fail on wrapped errors. Use errors.As to check for specific errors (errorlint)
switch x := err.(type) {
Short example
Runnable example
More fleshed out example in playground: https://go.dev/play/p/X7xE6VILmY9
Workaround
You can use errors.As with the interfaces to get around the linter in some cases.
If we were to create a breadth first version of
errors.As
then we would need to write code like the examples that trigger the lint.The text was updated successfully, but these errors were encountered: