From 465d835ee0ae6b486d53d538b2c9c84aa1870c79 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Tue, 17 Jul 2018 13:13:27 +0000 Subject: [PATCH] Default diff-printer to hide details This new setting will make it print the difference between String() output only. This is more usable for developers in 99% of cases where the difference can be seen. --- test/diff.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/diff.go b/test/diff.go index 477ae98f..5678972b 100644 --- a/test/diff.go +++ b/test/diff.go @@ -8,7 +8,9 @@ import ( // Diff diffs two arbitrary data structures, giving human-readable output. func Diff(want, have interface{}) string { config := spew.NewDefaultConfig() - config.ContinueOnMethod = true + // Set ContinueOnMethod to true if you cannot see a difference and + // want to look beyond the String() method + config.ContinueOnMethod = false config.SortKeys = true config.SpewKeys = true text, _ := difflib.GetUnifiedDiffString(difflib.UnifiedDiff{