Skip to content

Commit

Permalink
Remove an unnecessary block
Browse files Browse the repository at this point in the history
  • Loading branch information
tchssk committed Oct 28, 2024
1 parent ad7a079 commit 2c0cc21
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions codegen/service/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -697,24 +697,22 @@ func compatible(from expr.DataType, to reflect.Type, recs ...compRec) error {
ok bool
field reflect.StructField
)
{
if ef, k := nat.Attribute.Meta["struct:field:external"]; k {
fname = ef[0]
if fname == "-" {
continue
}
field, ok = to.FieldByName(ef[0])
} else if ef, k := nat.Attribute.Meta["struct.field.external"]; k { // Deprecated syntax. Only present for backward compatibility.
fname = ef[0]
if fname == "-" {
continue
}
field, ok = to.FieldByName(ef[0])
} else {
ef := codegen.Goify(ma.ElemName(nat.Name), true)
fname = ef
field, ok = to.FieldByName(ef)
if ef, k := nat.Attribute.Meta["struct:field:external"]; k {
fname = ef[0]
if fname == "-" {
continue
}
field, ok = to.FieldByName(ef[0])
} else if ef, k := nat.Attribute.Meta["struct.field.external"]; k { // Deprecated syntax. Only present for backward compatibility.
fname = ef[0]
if fname == "-" {
continue
}
field, ok = to.FieldByName(ef[0])
} else {
ef := codegen.Goify(ma.ElemName(nat.Name), true)
fname = ef
field, ok = to.FieldByName(ef)
}
if !ok {
return fmt.Errorf("types don't match: could not find field %q of external type %q matching attribute %q of type %q",
Expand Down

0 comments on commit 2c0cc21

Please sign in to comment.