Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/vet: make -all -shadow mean all default checks and also -shadow #13020
Currently the only way to run all vet checks in a single invocation is
It is possible to achieve the same effect by invoking go tool vet multiple times:
The problem with this approach is that if more experimental checks are added in the future or shadow become a standard checker these commands will have to be changed.
I propose to
This change will also allow integrating shadow vet check into Emacs flycheck package. See the following discussion for more details: flycheck/flycheck#765
I think you shouldn't turn on -shadow by default in your plugin. That is the underlying motivation for this change, but -shadow just isn't reliable enough to depend on. It doesn't work well at all. That's why it's disabled.
If you really want it enabled always (which is a very bad idea), just have the plugin turn it on.
Whether another experimental feature comes along, and what its properties, reliability, and safety might be are all unknown at this point, so planning for them in a way that others may depend on seems unwise.
I vote against this proposal.
First of all while the shadow check is not accurate I still find it helpful especially when used interactively with an editor. From my experience accidental shadowing usually leads to unpredictable bugs that are hard to track (possibly because I am coming from Java where shadowed variables are not allowed) and any help from the tools is appreciated.
Secondly the main motivation for this proposal is not to enable shadow check by default but to make it easier to turn it on by plugins.
The only way to run all vet checks (including shadow) at the moment is to invoke go vet twice. It is possible to do it from the flycheck but the plugin author is reluctant to accept such change because it adds more complexity and such approach is different from the rest of the checkers. It would be good if it was possible to have a new flycheck configuration option "enable-shadow" that just translates to a go vet command line flag.
The concern about any upcoming experimental features is reasonable though. I'd like to propose an alternative approach to