Skip to content

Generate a slice of "valid" values for an enum #1721

Open

Description

@jamietanna

As a common pattern seen across codebases

Note that we need to make sure the slice is new each time, to make sure it can be modified by a caller.

Activity

  1. AidanWelch commented on Oct 14, 2024

    @AidanWelch

    In my opinion, a map would be even better for this

  2. jamietanna commented on Apr 30, 2026

    @jamietanna
    MemberAuthor

    I'd say that #2227 partially solves this

  3. renom commented on Sep 3, 2026

    @renom
    Contributor

    Good idea 👍

  4. renom commented on Sep 7, 2026

    @renom
    Contributor

    I think the list (slice) can still be helpful. For example if I have to validate the complete list of possible values, not only a single value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:enumsenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions