cmd/vet: document better the cmd/go flags that go vet supports #21711
Comments
There is no reason whatever to pass -ldflags to vet. Just remove that flag from the call. The documentation could be better. The "standard build flags" really refers to compile-time features such as -n, -x, and -tags. The word "build" is being misused; a better term might be "diagnostic and package-finding". Go vet never builds, so any try build-time flags are pointless. The issue is how the go command identifies packages to pass to go tool vet. |
Ah ok. Yes, I understand that vet has no actual use for |
I don't really understand how it ever worked before. It shouldn't have. I consider the situation to be fixed rather than broken. |
I imagine that the flag was simply ignored before, as In any case, as @robpike says, it's very unlikely that the flag ever did anything useful before. The flag isn't supposed to work; vet doesn't build packages like |
Closing because it sounds like we aren't going to do anything here. Please comment if you disagree. |
Reopening with a different subject. As I said earlier, the documentation could be better. |
Change https://golang.org/cl/60830 mentions this issue: |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.9 linux/amd64
Does this issue reproduce with the latest release?
this is the latest release
What operating system and processor architecture are you using (
go env
)?What did you do?
I have a Makefile that (after variable expansion) runs:
go vet -ldflags="-X main.version=dev-2017-08-31T04:06:35+0000 " ./cmd/... ./utils/... ./pkg/... ./metadata/...
On 1.7, 1.8, this works. On go-1.9, this complains about
-ldflags
no longer being a valid option.I note the go-1.9 release notes make a point of saying:
I think what I'm seeing is the exact opposite of this.
What did you expect to see?
Successful
go vet
output/warnings.What did you see instead?
The text was updated successfully, but these errors were encountered: