Skip to content

Commit

Permalink
Handle diff.Normalize() retval in function calls
Browse files Browse the repository at this point in the history
Signed-off-by: Josh Hudson <382062+itmustbejj@users.noreply.github.com>
  • Loading branch information
itmustbejj committed Mar 30, 2024
1 parent f72530c commit f6aaa0e
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions pkg/diff/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,17 @@ func Diff(config, live *unstructured.Unstructured, opts ...Option) (*DiffResult,
o := applyOptions(opts)
if config != nil {
config = remarshal(config, o)
Normalize(config, opts...)
err := Normalize(config, opts...)
if err != nil {
return nil, err
}
}
if live != nil {
live = remarshal(live, o)
Normalize(live, opts...)
err := Normalize(live, opts...)
if err != nil {
return nil, err
}
}

if o.serverSideDiff {
Expand Down Expand Up @@ -118,7 +124,10 @@ func Diff(config, live *unstructured.Unstructured, opts ...Option) (*DiffResult,
o.log.V(1).Info(fmt.Sprintf("Failed to get last applied configuration: %v", err))
} else {
if orig != nil && config != nil {
Normalize(orig, opts...)
err := Normalize(orig, opts...)
if err != nil {
return nil, err
}
dr, err := ThreeWayDiff(orig, config, live)
if err == nil {
return dr, nil
Expand Down

0 comments on commit f6aaa0e

Please sign in to comment.