Skip to content

Inspection for structure initialization with a mixture of field:value and value initializers #2138

@dlsniper

Description

@dlsniper
package main

type demo struct {
    a int
    b int
}

func main() {
    dem := demo{
        a: 1,
        1, // mixture of field:value and value initializers
    }
    _ = dem
}

Go reports this on the field that is initialized without the name in case there is a situation where a mixture is used. However I think the error should be applied to the struct initialization part not the fields.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions