Open akalin opened 6 years ago
Hello @akalin .
This is not a testify bug.
In go lower case fields (labels in general) are not visible outside the defining package, reflect is outside.
So you have to upper your f field to "F"
You can read this for more informations : https://blog.golang.org/laws-of-reflection
go-spew, which testify uses, explicitly handles unexported fields; see https://github.com/davecgh/go-spew. So you're probably right in that the bug doesn't lie with testify directly. Perhaps it needs to revendor go-spew to a new version, or perhaps the bug is still in go-spew's tip.
In any case, testify panicking definitely seems like a bug to me, especially if assert
is used instead of require
.
I'm seeing the same behavior. This is a bug in testify, whether it's caused by testify code or indirectly by the dependency on spew. I've filed an issue with spew, since I can reproduce it independent of testify's usage:
Got the same problem here, this is definitely a spew issue (or bad spew version dependency here) only happening when the structs differ.
I note that spew has not seen a commit to its default branch for 4 years. It seems to be effectively unmaintained. I'm not sure what the best fix is here. It might make sense to borg the code into testify or to fork it and maintain that fork.
Minimal test case:
running
go test .
produces: