Skip to content

No new variables inspection should account for variable shadowing rules #1752

@gabrielf

Description

@gabrielf

The code below can run but the go plugin says it contains an error:

package main import ( "fmt" "strconv" ) func main() { ShouldAllowParameterShadowing("param") } func ShouldAllowParameterShadowing(i string) { fmt.Println(i) for i := 0; i < 3; i++ { // Inspection error "No new variables on left side of :=" fmt.Println(strconv.Itoa(i)) } }

But it will run correctly and output:

$ go run main.go param 0 1 2 

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions