Avoid unnecessary marshaling.

This commit is contained in:
Oleksii Kliukin
2017-05-12 11:41:30 +02:00
committed by Murat Kabilov
parent b69b6b26e5
commit 8db44d6f18
2 changed files with 6 additions and 12 deletions
+2 -8
View File
@@ -3,7 +3,6 @@ package util
import (
"crypto/md5"
"encoding/hex"
"encoding/json"
"fmt"
"math/rand"
"time"
@@ -13,6 +12,7 @@ import (
"github.bus.zalan.do/acid/postgres-operator/pkg/spec"
"k8s.io/client-go/pkg/api/v1"
"k8s.io/client-go/pkg/types"
"strings"
)
var passwordChars = []byte("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
@@ -70,11 +70,5 @@ func Pretty(x interface{}) (f fmt.Formatter) {
func PrettyDiff(a, b interface{}) (result string) {
diff := pretty.Diff(a, b)
json, err := json.MarshalIndent(diff, "", " ")
if err != nil {
result = fmt.Sprintf("%v", diff)
} else {
result = string(json)
}
return
return strings.Join(diff, "\n")
}