-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Panic: Equal on type aliases causes panic #644
Comments
👍 just hit this took a while to debug |
Created a PR here which should solve the problem 😊 |
Nice, thanks Harald! |
@HaraldNordgren could you comment on the difference between this solution and the one referenced above (#651)? |
@georgelesica-wf I'm not sure, both solutions might be equivalent. But the other solution is currently untested which is a problem for a testing library. |
@HaraldNordgren agreed, thanks for looking at it. I just want to make sure that we resolve all the issues people have seen with this bit of code. |
Current behaviour:
With go 1.9.3 and testify 1.2.2 or latest master (f35b8ab) if I require/assert.Equal two aliased types, it causes testify to panic:
Expected behaviour: testify should determine if the two types are equal, or fail gracefully.
Here is a test case to replicate the issue
I don't know much about reflect, but I think it comes down to this:
ek == String comes back as true for string type aliases since they are of kind string, however a type assertion causes a panic since they are not of type string.
My workaround for now is not to use Equal with type aliases, however this is something that should be handled internally.
The text was updated successfully, but these errors were encountered: