Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/vet: line numbers don't show up for "internal package not allowed" errors from _test files #36173
What version of Go are you using (
If the error comes from flycheck and not go-vet, then I'm afraid there is nothing we can do here.
But the issue you linked to shows that the issue is with vet. Could you please clarify ?
Please post the exact instructions that we can run from the command line to reproduce this. Thank you.
I think there are two bugs here (one in flycheck and one in the
Notice that the first invocation reports line numbers, and the second invocation does not.
How hard is it to fix this error message to have the right line numbers?
To be clear, Flycheck is failing because go-vet is producing error messages that don't match the usual pattern (which includes a line number). Fixing that is just a matter of making that message conform to the usual template.
Now, the reason users are running into this message is that we create a temporary copy of their file (including unsaved changes) in a temporary directory before running go-vet; this breaks imports.
The ideal solution for us would be a way to feed file contents to go vet on stdin; then we wouldn't have to create temporary files: we'd just pass unsaved file contents on stdin and tell go-vet what the original file name was, so it could look up the imports properly. (this is what we're doing with most other checkers).
Yes, this is a regression. The bug is in Go 1.13, but not in Go 1.12
Create a Dockerfile like
Note that if I change the go version to 1.12 in the Dockerfile I get:
which has the correct error message
This change is a non-minimal fix for #32917, but incidentally fixes several other bugs and makes the error messages much more ergonomic. Updates #32917 Updates #27122 Updates #28459 Updates #29280 Updates #30590 Updates #37214 Updates #36173 Updates #36587 Fixes #36008 Fixes #30992 Change-Id: Iedb26d2e0963697c130df5d0f72e7f83ec2dcf06 Reviewed-on: https://go-review.googlesource.com/c/go/+/185345 Reviewed-by: Michael Matloob <firstname.lastname@example.org> Reviewed-by: Jay Conrod <email@example.com>
…versions Go 1.15+, as of CL 224660, puts the importing package on the top of the stack (because it makes more sense in the errors). Look there by default and fall back to second from top position if top of stack is the package itself. Updates golang/go#36173 Change-Id: I1681089b4a18af9e535661668329ad32b1ba1936 Reviewed-on: https://go-review.googlesource.com/c/tools/+/225677 Run-TryBot: Michael Matloob <firstname.lastname@example.org> TryBot-Result: Gobot Gobot <email@example.com> Reviewed-by: Bryan C. Mills <firstname.lastname@example.org> Reviewed-by: Rebecca Stambler <email@example.com>