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 Nov 22, 2023
1 parent c2efd53 commit 8f851f1
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 @@ -76,11 +76,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
}
}

// TODO The two variables bellow are necessary because there is a cyclic
Expand Down Expand Up @@ -109,7 +115,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 8f851f1

Please sign in to comment.