1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-05 15:37:19 +00:00

NK-31: Fixed compilation

This commit is contained in:
belyshevdenis 2019-03-12 14:53:32 +02:00
parent 6845b48068
commit 040ea99f41

View file

@ -186,17 +186,13 @@ func serializePatch(patch types.PolicyPatch) ([]byte, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
processedPatchValue, err := processPatchValue(patch.Value)
if err != nil { patch = types.PolicyPatch{
return nil, err Path: patch.Path,
} else { Operation: patch.Operation,
patch = types.PolicyPatch{ Value: processPatchValue(patch.Value),
Path: patch.Path,
Operation: patch.Operation,
Value: processedPatchValue,
}
return json.Marshal(patch)
} }
return json.Marshal(patch)
} }
// Recursively converts all numbers to strings in JSONPatch value. // Recursively converts all numbers to strings in JSONPatch value.
@ -206,9 +202,9 @@ func processPatchValue(value interface{}) interface{} {
for k, v := range interfaceMap { for k, v := range interfaceMap {
newMap[k] = processPatchValue(v) newMap[k] = processPatchValue(v)
} }
return newMap, nil return newMap
} else { } else {
return fmt.Sprintf("%v", value), nil return fmt.Sprintf("%v", value)
} }
} }