diff options
author | Joe Tsai <joetsai@digital-static.net> | 2020-06-12 15:29:35 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-12 15:29:35 -0700 |
commit | 44914b370698a5a9ce868549d62d79473faebacc (patch) | |
tree | 04b9b2f2bc3a703c4515b20f64ffa10880358c1b /cmp/report_slices.go | |
parent | f1780cfdde930250f45fbe0bb6e107be5b4e9514 (diff) | |
download | go-cmp-44914b370698a5a9ce868549d62d79473faebacc.tar.gz |
Disambiguate reporter output (#216)
The reporter tries to aggresively elide data that is not interesting
to the user. However, doing so many result in an output that does not
visually indicate the difference between semantically different objects.
This CL modifies the reporter to try increasingly verbose presets until
two different objects are formatted differently.
This CL includes a custom implementation of reflect.Type.String that
can print the type with fully qualified names to disambiguate types
that happen to have the same base package name.
Fixes #194
Diffstat (limited to 'cmp/report_slices.go')
-rw-r--r-- | cmp/report_slices.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cmp/report_slices.go b/cmp/report_slices.go index cfd1b60..49fc5ec 100644 --- a/cmp/report_slices.go +++ b/cmp/report_slices.go @@ -26,8 +26,8 @@ func (opts formatOptions) CanFormatDiffSlice(v *valueNode) bool { return false // No differences detected case !v.ValueX.IsValid() || !v.ValueY.IsValid(): return false // Both values must be valid - case v.Type.Kind() == reflect.Slice && (v.ValueX.IsNil() || v.ValueY.IsNil()): - return false // Both of values have to be non-nil + case v.Type.Kind() == reflect.Slice && (v.ValueX.Len() == 0 || v.ValueY.Len() == 0): + return false // Both slice values have to be non-empty case v.NumIgnored > 0: return false // Some ignore option was used case v.NumTransformed > 0: |