You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"check for shadowed variables (experimental; must be set explicitly)",
The good news is, go help vet mentions the shadow check explicitly:
For example, the 'shadow' analyzer can be built and run using these commands:
go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow
go vet -vettool=$(which shadow)
And it seems to work; at the very least it doesn't crash:
_gopath/src/vetshadowrepro$ GO111MODULE=off go vet -vettool=$(which shadow) vetshadowrepro/...
_gopath/src/vetshadowrepro$ GO111MODULE=on go vet -vettool=$(which shadow) vetshadowrepro/...
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes, same error occurs on
go version go1.11.4 darwin/amd64
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Create minimal repro package:
repro.go has contents:
and project.go has contents:
Running
go tool vet --shadow vetshadowrepro
gives internal error in output:What did you expect to see?
No error because the project variable declaration does not shadow. Seems vet is confused by the import path being different to the package name.
What did you see instead?
Internal error:
The text was updated successfully, but these errors were encountered: