New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/vet: starting in Go 1.10, output order is not deterministic for multiple packages #24309
Comments
Based on the observed behavior, it looks like This has the unfortunate side effect that the output of failing runs of |
I think we don't make any guarantee about the order of the vet output on multiple packages.
Tests breaking because you are diffing assuming a specific output order is often a red flag; those test are bound to be brittle. The usual workaround (may not be applicable in your case, but still) is to stop diffing and start grepping for specific things that you don't want to be in the output. |
Forcing serial execution won't necessarily make the output deterministic. The old vet never made any promises about deterministic output that I am aware of. It would also make vet slower, and require an extra flag. Why not sort the output before passing it to diff? |
Also, as @ALTree mentioned, you should really be using a whitelist of vet warnings to ignore. The standard library does this too. With that method, the output order doesn't matter at all. |
Thanks for the clarification -- I understand all the points, and don't think this is a major issue so I'm fine with this. Also, I verified/confirmed that setting the |
What version of Go are you using (
go version
)?go version go1.10 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?darwin-amd64
What did you do?
vet
error that also has a subpackage with avet
errorgo vet . ./bad2
to rungo vet
on both packagesWhat did you expect to see?
I expected that the output ordering of the packages would match that of the input -- the errors in the current package would be reported first, followed by those in
bad2
. This was the case up through Go 1.9.What did you see instead?
The order of the output was not deterministic.
Output of multiple runs in Go 1.10:
Output of multiple runs in Go 1.9:
The text was updated successfully, but these errors were encountered: