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
The -shadow option on vet is documented to be poor; that's why it's not enabled by default. There are many outstanding bugs against it and maybe someday someone will redo it with a better algorithm to make it more robust.
Regardless, line 152 isn't really shadowing, since the variable it creates doesn't hide one earlier in any semantically detectable way. In other words, although it has the same name as the outer err, renaming it (or using '=' instead of ':=') would have no effect on the program.
The -shadow warning is documented to only be issued if the shadowed variable is used after the shadowing variable is declared. That does not happen at line 152.
What version of Go are you using (
go version
)?1.9
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?darwin/amd64, linux/amd64
Steps to reproduce
Actual & expect result
go vet
correctly reports three shadowed vars (in line 134, 142, 145, the ones marked with// nolint: vetshadow
), but misses one in line 152: https://github.com/leonklingele/pick/blob/fix-var-shadowing/safe/note.go#L152I tried to create a smaller reproducible, but wasn't able to achieve this.
The text was updated successfully, but these errors were encountered: