V8027. Suspicious subexpression in a sequence of similar comparisons.
The analyzer has detected a code fragment that most likely contains a typo. A chain of similar structure member comparisons contains an expression that differs from the others. It compares members with different names, while the rest of the chain compares members with the same name.
The example:
func foo(a TestStruct, b TestStruct) interface{} {
if a.x == b.x && a.y == b.y && a.z == b.y {
....
}
}
In this case, the a.z == b.y expression differs from the other elements in the chain. The error most likely occurred due to a typo made while editing the copied text.
The fixed code:
func foo(a TestStruct, b TestStruct) interface{} {
if a.x == b.x && a.y == b.y && a.z == b.z {
....
}
}
The analyzer issues a warning whenever the comparison chain has more than two expressions.