mirror of
https://github.com/weaveworks/scope.git
synced 2026-02-14 18:09:59 +00:00
Make dumper a bit more verbose
So it displays differences behind interface that would otherwise go unnoticed (like string vs []byte).
This commit is contained in:
12
test/diff.go
12
test/diff.go
@@ -5,15 +5,15 @@ import (
|
||||
"github.com/pmezard/go-difflib/difflib"
|
||||
)
|
||||
|
||||
func init() {
|
||||
spew.Config.SortKeys = true // :\
|
||||
}
|
||||
|
||||
// Diff diffs two arbitrary data structures, giving human-readable output.
|
||||
func Diff(want, have interface{}) string {
|
||||
config := spew.NewDefaultConfig()
|
||||
config.ContinueOnMethod = true
|
||||
config.SortKeys = true
|
||||
config.SpewKeys = true
|
||||
text, _ := difflib.GetUnifiedDiffString(difflib.UnifiedDiff{
|
||||
A: difflib.SplitLines(spew.Sdump(want)),
|
||||
B: difflib.SplitLines(spew.Sdump(have)),
|
||||
A: difflib.SplitLines(config.Sdump(want)),
|
||||
B: difflib.SplitLines(config.Sdump(have)),
|
||||
FromFile: "want",
|
||||
ToFile: "have",
|
||||
Context: 3,
|
||||
|
||||
Reference in New Issue
Block a user