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
HaveField only locates non-pointer receiver functions, but not pointer receivers. In the following minimal example (on playground), HaveField locates the non-pointer receiver for T, but then fails for the pointer receiver of T2.
I would have expected HaveField to shield test writers from such "nitty" details. Should we fix it (the matcher, not the writer)? How so; by taking the pointer to the struct value when the lookup fails and retrying again?
The text was updated successfully, but these errors were encountered:
thediveo
added a commit
to thediveo/gomega
that referenced
this issue
Apr 17, 2022
Not so much oversight as one of the darker corners of Go. I still think that the FAQ on value versus pointer receivers should be blunt and just stating "Shhh, Go away!"
HaveField
only locates non-pointer receiver functions, but not pointer receivers. In the following minimal example (on playground),HaveField
locates the non-pointer receiver forT
, but then fails for the pointer receiver ofT2
.I would have expected
HaveField
to shield test writers from such "nitty" details. Should we fix it (the matcher, not the writer)? How so; by taking the pointer to the struct value when the lookup fails and retrying again?The text was updated successfully, but these errors were encountered: