Skip to content

no differences reported for maps where values are empty structs #100

Open
@aexvir

Description

@aexvir

in a case where there is a type defined such as

type Set map[string]struct{}

the result of diffing these types always ends up with an empty changelog, even if there are differences on the keys

after digging a bit through the codebase I've realized that the structValues method won't add any entry to the changelog if the struct has no fields; when diffing maps, for a specific key, if any of the maps doesn't have a value for that key, there is a shortcut that simply returns the output of structValues as either create or delete depending which map is missing the data

this, effectively makes the changelog to be empty for the following case

a := Set{"existing": struct{}}
b := Set{}

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