Skip to content

Commit 8f851f1

Browse files
committed
Handle diff.Normalize() retval in function calls
Signed-off-by: Josh Hudson <[email protected]>
1 parent c2efd53 commit 8f851f1

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

pkg/diff/diff.go

+12-3
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,17 @@ func Diff(config, live *unstructured.Unstructured, opts ...Option) (*DiffResult,
7676
o := applyOptions(opts)
7777
if config != nil {
7878
config = remarshal(config, o)
79-
Normalize(config, opts...)
79+
err := Normalize(config, opts...)
80+
if err != nil {
81+
return nil, err
82+
}
8083
}
8184
if live != nil {
8285
live = remarshal(live, o)
83-
Normalize(live, opts...)
86+
err := Normalize(live, opts...)
87+
if err != nil {
88+
return nil, err
89+
}
8490
}
8591

8692
// TODO The two variables bellow are necessary because there is a cyclic
@@ -109,7 +115,10 @@ func Diff(config, live *unstructured.Unstructured, opts ...Option) (*DiffResult,
109115
o.log.V(1).Info(fmt.Sprintf("Failed to get last applied configuration: %v", err))
110116
} else {
111117
if orig != nil && config != nil {
112-
Normalize(orig, opts...)
118+
err := Normalize(orig, opts...)
119+
if err != nil {
120+
return nil, err
121+
}
113122
dr, err := ThreeWayDiff(orig, config, live)
114123
if err == nil {
115124
return dr, nil

0 commit comments

Comments
 (0)