diff --git a/patch/annotation.go b/patch/annotation.go index 918dad6..15b3b14 100644 --- a/patch/annotation.go +++ b/patch/annotation.go @@ -115,7 +115,7 @@ func (a *Annotator) GetModifiedConfiguration(obj runtime.Object, annotate bool) a.metadataAccessor.SetAnnotations(obj, nil) } - modified, err = json.Marshal(obj) + modified, err = json.ConfigCompatibleWithStandardLibrary.Marshal(obj) if err != nil { return nil, err } @@ -126,7 +126,7 @@ func (a *Annotator) GetModifiedConfiguration(obj runtime.Object, annotate bool) return nil, err } - modified, err = json.Marshal(obj) + modified, err = json.ConfigCompatibleWithStandardLibrary.Marshal(obj) if err != nil { return nil, err } diff --git a/patch/deletenull.go b/patch/deletenull.go index 479a53a..62dbc2d 100644 --- a/patch/deletenull.go +++ b/patch/deletenull.go @@ -101,7 +101,7 @@ func DeleteNullInJson(jsonBytes []byte) ([]byte, map[string]interface{}, error) return nil, nil, emperror.Wrap(err, "could not delete null values from patch map") } - o, err := json.Marshal(filteredMap) + o, err := json.ConfigCompatibleWithStandardLibrary.Marshal(filteredMap) if err != nil { return nil, nil, emperror.Wrap(err, "could not marshal filtered patch map") } @@ -183,7 +183,7 @@ func deleteStatusField(obj []byte) ([]byte, error) { return []byte{}, emperror.Wrap(err, "could not unmarshal byte sequence") } delete(objectMap, "status") - obj, err = json.Marshal(objectMap) + obj, err = json.ConfigCompatibleWithStandardLibrary.Marshal(objectMap) if err != nil { return []byte{}, emperror.Wrap(err, "could not marshal byte sequence") } @@ -206,7 +206,7 @@ func deleteVolumeClaimTemplateFields(obj []byte) ([]byte, error) { } } - obj, err = json.Marshal(sts) + obj, err = json.ConfigCompatibleWithStandardLibrary.Marshal(sts) if err != nil { return []byte{}, emperror.Wrap(err, "could not marshal byte sequence") } diff --git a/patch/patch.go b/patch/patch.go index 9c5778b..091cb18 100644 --- a/patch/patch.go +++ b/patch/patch.go @@ -39,12 +39,12 @@ func NewPatchMaker(annotator *Annotator) *PatchMaker { } func (p *PatchMaker) Calculate(currentObject, modifiedObject runtime.Object, opts ...CalculateOption) (*PatchResult, error) { - current, err := json.Marshal(currentObject) + current, err := json.ConfigCompatibleWithStandardLibrary.Marshal(currentObject) if err != nil { return nil, emperror.Wrap(err, "Failed to convert current object to byte sequence") } - modified, err := json.Marshal(modifiedObject) + modified, err := json.ConfigCompatibleWithStandardLibrary.Marshal(modifiedObject) if err != nil { return nil, emperror.Wrap(err, "Failed to convert current object to byte sequence") }