Open mekegi opened 5 years ago
@mekegi: This looks good to me, except can you please add a flag use_go_cmp=true
. That way people who want the old behavior (minus a dependency) can use it.
I see it has been a year since this PR was created. I would love to use cmp
instead of reflect
. Is going to get merged or is it dead?
+1
Now gopls checks DeepEqual
with errors.
17:03:20 ➜ gopls check app/grpc/handlers_test.go
/Users/jeff/proj/learning/app/grpc/handlers_test.go:2073:9-49: avoid using reflect.DeepEqual with errors
/Users/jeff/proj/learning/app/grpc/handlers_test.go:3163:7-55: avoid using reflect.DeepEqual with errors
/Users/jeff/proj/learning/app/grpc/handlers_test.go:4498:9-49: avoid using reflect.DeepEqual with errors
/Users/jeff/proj/learning/app/grpc/handlers_test.go:5076:9-49: avoid using reflect.DeepEqual with errors
/Users/jeff/proj/learning/app/grpc/handlers_test.go:5291:9-49: avoid using reflect.DeepEqual with errors
If OP or someone else can update this PR to resolve branch conflicts, I will approve it.
https://github.com/cweill/gotests/issues/98
https://github.com/google/go-cmp/ is more usefull then reflect.DeepEqual
I changed reflect.DeepEqual to cmp.Equal and add to t.Errorf cmp.Diff for more detailed view of diff between got and want for exmaple how it looks like