Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
sters committed Jan 26, 2023
1 parent 78eb18d commit 80144e3
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions yamldiff/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,22 +311,22 @@ func (r *runner) handlePrimitive(rawA rawType, rawB rawType, level int) *diff {
case rawA == nil && rawB == nil:
result.status = DiffStatusSame
case rawA == missingKey:
if r.option.emptyAsNull && (rawB == nil || string(strB) == "{}" || string(strB) == "[]") {
switch {
case r.option.emptyAsNull && (rawB == nil || string(strB) == "{}" || string(strB) == "[]"),
r.option.zeroAsNull && (reflect.ValueOf(rawB).IsValid() && reflect.ValueOf(rawB).IsZero()):
result.status = DiffStatusSame
} else if r.option.zeroAsNull && (reflect.ValueOf(rawB).IsValid() && reflect.ValueOf(rawB).IsZero()) {
result.status = DiffStatusSame
} else {
default:
result.a = nil
result.status = DiffStatus1Missing
result.diffCount = len(strB)
}

case rawB == missingKey:
if r.option.emptyAsNull && rawA == nil {
result.status = DiffStatusSame
} else if r.option.zeroAsNull && (reflect.ValueOf(rawA).IsValid() && reflect.ValueOf(rawA).IsZero()) {
switch {
case r.option.emptyAsNull && rawA == nil,
r.option.zeroAsNull && (reflect.ValueOf(rawA).IsValid() && reflect.ValueOf(rawA).IsZero()):
result.status = DiffStatusSame
} else {
default:
result.b = nil
result.status = DiffStatus2Missing
result.diffCount = len(strA)
Expand Down

0 comments on commit 80144e3

Please sign in to comment.