From c44cfff988cf082f0ab65f64f416961ffe73515a Mon Sep 17 00:00:00 2001 From: Murat Kabilov Date: Tue, 26 Sep 2017 13:13:15 +0200 Subject: [PATCH] add Diff util method --- pkg/util/util.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pkg/util/util.go b/pkg/util/util.go index bee6607a8..49ecb31e6 100644 --- a/pkg/util/util.go +++ b/pkg/util/util.go @@ -52,10 +52,14 @@ func PGUserPassword(user spec.PgUser) string { return md5prefix + hex.EncodeToString(s[:]) } +// Diff returns diffs between 2 objects +func Diff(a, b interface{}) []string { + return pretty.Diff(a, b) +} + // PrettyDiff shows the diff between 2 objects in an easy to understand format. It is mainly used for debugging output. -func PrettyDiff(a, b interface{}) (result string) { - diff := pretty.Diff(a, b) - return strings.Join(diff, "\n") +func PrettyDiff(a, b interface{}) string { + return strings.Join(Diff(a, b), "\n") } // SubstractStringSlices finds elements in a that are not in b and return them as a result slice.