Skip to content

Commit

Permalink
Reduce nesting
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Salaberria <[email protected]>
  • Loading branch information
psalaberria002 committed Jun 8, 2022
1 parent af92682 commit 83d2f0b
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions pkg/api/getambassador.io/v2/handwritten.conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -667,17 +667,15 @@ func Convert_v2_TracingServiceSpec_To_v3alpha1_TracingServiceSpec(in *TracingSer
// WARNING: in.TagHeaders requires manual conversion: does not exist in peer-type
// if only tag_headers are set, translate to custom_tags.
// if both are set, ignore tag_headers.
if in.TagHeaders != nil {
if in.V3CustomTags == nil {
out.CustomTags = []v3alpha1.TracingCustomTag{}
for _, tag := range in.TagHeaders {
out.CustomTags = append(out.CustomTags, v3alpha1.TracingCustomTag{
Tag: tag,
Header: &v3alpha1.TracingCustomTagTypeRequestHeader{
Name: tag,
},
})
}
if in.TagHeaders != nil && in.V3CustomTags == nil {
out.CustomTags = []v3alpha1.TracingCustomTag{}
for _, tag := range in.TagHeaders {
out.CustomTags = append(out.CustomTags, v3alpha1.TracingCustomTag{
Tag: tag,
Header: &v3alpha1.TracingCustomTagTypeRequestHeader{
Name: tag,
},
})
}
}
return nil
Expand Down

0 comments on commit 83d2f0b

Please sign in to comment.