Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/vet: bool checker issues a triangular number of errors #28086
The vet command's bool checker reports progressively more errors as the redundancy in an expression grows. For 7 copies, it reports 1+2+3+4+5+6 errors, because it reports all the errors in each subtree.
In realistic cases the redundancy is always n=2 so vet only prints n(n-1)/2 = 1 error and there's no problem in practice. However, vet's test suite exercises deeper expressions that lead to redundant errors that are ignored by vet's current test harness because they all match the correct regexp. The new x/tools/go/analysis test harness is more precise and requires multiple expectations for multiple errors. I do not wish to change the checker logic during the migration to the new API, so the task of this issue is to fix the checker logic and remove the workaround from the tests.
And rename from "bool" to "bools". Using analysistest unearthed a minor bug, github.com/golang/go/issues/28086. To avoid complicating the diff we work around it in the tests for now. Change-Id: I682f33506de778dfdfe97841cd2b16e3d47062b8 Reviewed-on: https://go-review.googlesource.com/c/140737 Reviewed-by: Michael Matloob <email@example.com> Run-TryBot: Michael Matloob <firstname.lastname@example.org>