Skip to content
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

cmd/vet: Add a warning when := causes a variable name to be shadowed #5634

Closed
ianlancetaylor opened this issue Jun 4, 2013 · 1 comment
Closed

Comments

@ianlancetaylor
Copy link
Contributor

The language permits shadowing with := as long as both variables are used after they are
defined.  However, it would be reasonable for go vet to warn if := is used to define a
local variable when there is a local variable of the same name in an enclosing block.

Example: http://play.golang.org/p/DQDXOyfwRl .  A quick glance might  lead one to think
this program would print 2, but it prints 0.
@robpike
Copy link
Contributor

robpike commented Jun 21, 2013

Comment 1:

This issue was closed by revision golang/tools@331c428.

Status changed to Fixed.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
@rsc rsc unassigned robpike Jun 22, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants