-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/vet: declared but not used #23887
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
Comments
Assignment-only expressions don't count as "use" -- you need a read. Both |
The fact that gc should issue an error (and it doesn't) is #3059. Also this is not vet reporting an issue, but go/types correctly raising an error during typechecking. I guess vet was changed during the 1.10 cycle to print typechecking errors instead of ignoring them. |
Found the discussion, is at #21287 (cmd/vet: decide how to handle type checking failure). Final decision was:
Explicitly mentioning this change in the 1.10 release notes would have been nice, but I don't see anything in https://golang.org/doc/go1.10#vet Anyway, vet side, this is working as expected. We still have the gc issue I linked above. |
I don't think there is anything to do here. The vet error is correct, even if the compiler proper doesn't catch it. Closing. |
What version of Go are you using (
go version
)?go version go1.10 linux/amd64
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?amd64
What did you do?
https://play.golang.org/p/w8ySRRDrihm
go vet // fails, didn't fail pre go1.10
go run main.go // no problem
if you change counter = 1 to counter++ or counter = counter + 1 there is no error
What did you expect to see?
no error
What did you see instead?
./main.go:8:2: counter declared but not used
vet: typecheck failures
The text was updated successfully, but these errors were encountered: