Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/vet: detect stupid conditions #7622
It would be nice if vet detected a few obviously stupid boolean conditions. This can probably be done purely at a syntactic level, without recourse to any type checking. x == y || x == y is a redundant test, assuming neither x nor y contains function calls or channel operations. x != y || x != z is not guaranteed to be wrong but almost always is. If y and z are the same then it's redundant; if y and z are different then it's always true.