From 040ea99f4157cc1ceb6765c1bff35b78f165c981 Mon Sep 17 00:00:00 2001 From: belyshevdenis Date: Tue, 12 Mar 2019 14:53:32 +0200 Subject: [PATCH] NK-31: Fixed compilation --- webhooks/mutation.go | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/webhooks/mutation.go b/webhooks/mutation.go index 00a5fd6c6d..384320d631 100644 --- a/webhooks/mutation.go +++ b/webhooks/mutation.go @@ -186,17 +186,13 @@ func serializePatch(patch types.PolicyPatch) ([]byte, error) { if err != nil { return nil, err } - processedPatchValue, err := processPatchValue(patch.Value) - if err != nil { - return nil, err - } else { - patch = types.PolicyPatch{ - Path: patch.Path, - Operation: patch.Operation, - Value: processedPatchValue, - } - return json.Marshal(patch) + + patch = types.PolicyPatch{ + Path: patch.Path, + Operation: patch.Operation, + Value: processPatchValue(patch.Value), } + return json.Marshal(patch) } // Recursively converts all numbers to strings in JSONPatch value. @@ -206,9 +202,9 @@ func processPatchValue(value interface{}) interface{} { for k, v := range interfaceMap { newMap[k] = processPatchValue(v) } - return newMap, nil + return newMap } else { - return fmt.Sprintf("%v", value), nil + return fmt.Sprintf("%v", value) } }