-
Notifications
You must be signed in to change notification settings - Fork 19k
x/tools: shadow analyzer does not consider variables declared in for-range statement #44986
Copy link
Copy link
Open
Labels
AnalysisIssues related to static analysis (vet, x/tools/go/analysis)Issues related to static analysis (vet, x/tools/go/analysis)FeatureRequestIssues asking for a new feature that does not need a proposal.Issues asking for a new feature that does not need a proposal.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.ToolsThis label describes issues relating to any tools in the x/tools repository.This label describes issues relating to any tools in the x/tools repository.
Milestone
Metadata
Metadata
Assignees
Labels
AnalysisIssues related to static analysis (vet, x/tools/go/analysis)Issues related to static analysis (vet, x/tools/go/analysis)FeatureRequestIssues asking for a new feature that does not need a proposal.Issues asking for a new feature that does not need a proposal.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.ToolsThis label describes issues relating to any tools in the x/tools repository.This label describes issues relating to any tools in the x/tools repository.
Type
Fields
Give feedbackNo fields configured for issues without a type.
What version of Go are you using (
go version)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env)?go envOutputWhat did you do?
Installed and ran the shadow analyzer on a file witht the contents below:
$ go get -u -v golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow $ cat tt.go package main import ( "fmt" ) func main() { n := 10 total := 0 for _, n := range []int{1, 2, 3} { total += n } fmt.Printf("total is %d, n is %d\n", total, n) } $ shadow tt.go $No warning was generated
What did you expect to see?
A message similar to:
What did you see instead?
No output from the shadow tool.