This repository was archived by the owner on May 9, 2021. It is now read-only.

Description
A common antipattern I see in production code is using reflect.DeepEqual on errors in tests, which results in brittle tests. Even just adding more diagnostic information to the error can break it. The more proper thing to do is either:
- Check whether a substring is present in the error message (not great, but more correct).
- Use something like Dave Cheney's errors package to make the system-under-test provide more useful errors (great! because it's better API design anyway).
It would be helpful to have a lint check that discourages this by warning when either parameter to reflect.DeepEqual is of error type.
One additional point, quoting @dsnet:
If they are structs that contain a field of an error type, no warning is given. While I would consider using deep equal in that case a code smell, there are legitimate uses of it when it is used to compare sentinel errors.
(This was originally reported as golang/go#16748.)