Skip to content

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

@NitriKx

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

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions