501 } else if agentErr != nil {
502 captureError(ctx, fmt.Errorf("dns error looking up: %s %s: %v", orgSlug, appName, agentErr), "agentclient-instances", orgSlug, appName)
503 return gqlResult.Instances, nil
504 } else if !arrayEqual(gqlResult.Instances.Addresses, agentResult.Addresses) {505 return gqlResult.Instances, nil
506 } else {
507 return gqlResult.Instances, nil
Identical code is present in more than one branch of the conditional branches. It is recommended to either remove the duplicates or club the conditional cases so that duplication can be reduced.
if x > y {
println("x is greater")
} else {
// But `y >= x` here.
println("x is greater")
}
if x > y {
println("x is greater")
} else {
// As `y >= x`, `y is greater` is almost
// correct but `x is greater` was not.
println("y is greater")
}
// As both cases evaluate to same body, then `if-else`
// is not even required.
println("x is greater")