Skip to content

Commit 5279a41

Browse files
authored
Merge pull request #1107 from fluxcd/expose-diff
ssa/jsondiff: expose DiffUnstructured
2 parents 18225b1 + 29e75f1 commit 5279a41

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

ssa/jsondiff/unstructured.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ func Unstructured(ctx context.Context, c client.Client, obj *unstructured.Unstru
185185
}
186186
patch = append(patch, metaPatch...)
187187

188-
resPatch, err := diffUnstructured(filteredObj, dryRunObj, diffOpts...)
188+
resPatch, err := DiffUnstructured(filteredObj, dryRunObj, diffOpts...)
189189
if err != nil {
190190
return nil, err
191191
}
@@ -228,9 +228,9 @@ func diffUnstructuredMetadata(x, y *unstructured.Unstructured, opts ...jsondiff.
228228
return filteredPatch, nil
229229
}
230230

231-
// diffUnstructured returns a JSON patch with the differences between the given
231+
// DiffUnstructured returns a JSON patch with the differences between the given
232232
// objects while ignoring "metadata" and "status" fields.
233-
func diffUnstructured(x, y *unstructured.Unstructured, opts ...jsondiff.Option) (jsondiff.Patch, error) {
233+
func DiffUnstructured(x, y *unstructured.Unstructured, opts ...jsondiff.Option) (jsondiff.Patch, error) {
234234
xSpec, ySpec := removeMetadataAndStatus(x), removeMetadataAndStatus(y)
235235
patch, err := jsondiff.Compare(xSpec.Object, ySpec.Object, opts...)
236236
if err != nil {

ssa/jsondiff/unstructured_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1286,7 +1286,7 @@ func Test_diffUnstructured(t *testing.T) {
12861286
}
12871287
for _, tt := range tests {
12881288
t.Run(tt.name, func(t *testing.T) {
1289-
got, err := diffUnstructured(tt.x, tt.y, tt.opts...)
1289+
got, err := DiffUnstructured(tt.x, tt.y, tt.opts...)
12901290
if (err != nil) != tt.wantErr {
12911291
t.Errorf("diffResourceMetadata() error = %v, wantErr %v", err, tt.wantErr)
12921292
return

0 commit comments

Comments
 (0)