Skip to content

iterate-over-empty-map warning on map initialised at the declaration #36

Description

@NitriKx

Hello,

I'm struggling to understand why the following code function has a iterate-over-empty-map:

func iter2(){
    m := map[string]int {
        "toto": 1
    }

    fmt.Println("iterating")
    for v := range m {
        fmt.Println("map item: ", v)
    }
}

Could you help me with that? 🙏
cc @Caomoji

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions