Skip to content

Unused variable declared in a type switch is not reported #1696

@horkhe

Description

@horkhe

The following snippet is rendered as correct but it has a compiler error:

func Test(p interface{}) error {
    switch p := p.(type) {  // should be error: "p declared and not used"
    case error:
        return nil
    }
    return nil
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions