Skip to content

error-is-as: *error argument should be considered valid #192

Closed Answered by Antonboom
orestisfl asked this question in Q&A
Discussion options

You must be logged in to vote

@orestisfl, hi!

This is common gotcha not related to testify, but related to errors.As,
because any error is assignable to any error (link):

if reflectlite.TypeOf(err).AssignableTo(targetType) {

testifylint repeats go vet's erroras check logic in this case:

The errorsas analysis reports calls to errors.As where the type
of the second argument is not a pointer to a type implementing error.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by Antonboom
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested wontfix This will not be worked on
2 participants
Converted from issue

This discussion was converted from issue #178 on October 05, 2024 06:40.