add Diff util method
This commit is contained in:
parent
c67f06956e
commit
c44cfff988
|
|
@ -52,10 +52,14 @@ func PGUserPassword(user spec.PgUser) string {
|
||||||
return md5prefix + hex.EncodeToString(s[:])
|
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.
|
// 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) {
|
func PrettyDiff(a, b interface{}) string {
|
||||||
diff := pretty.Diff(a, b)
|
return strings.Join(Diff(a, b), "\n")
|
||||||
return strings.Join(diff, "\n")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SubstractStringSlices finds elements in a that are not in b and return them as a result slice.
|
// SubstractStringSlices finds elements in a that are not in b and return them as a result slice.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue