Skip to content

Enum value collision #625

@martinwangen

Description

@martinwangen

In the release notes it says value collision should be handled like this:
// Defines values for Enum1.
const (
Enum1One Enum1 = "One"
Enum1Three Enum1 = "Three"
Enum1Two Enum1 = "Two"
)

// Defines values for Enum2.
const (
Enum2One Enum2 = "One"
Enum2Three Enum2 = "Three"
Enum2Two Enum2 = "Two"
)

However, in my project it is handled like this
// Defines values for Enum1.
const (
One Enum1 = "One"
Three Enum1 = "Three"
Two Enum1 = "Two"
)

// Defines values for Enum2.
const (
Enum2One Enum2 = "One"
Enum2Three Enum2 = "Three"
Enum2Two Enum2 = "Two"
)

If colliding, a prefix is appended, but this creates inconsistency in my code. Not even sure if this will be generated the same way each time or if this can end up being swapped at one point.

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