Skip to content

support const "enum" values with stringer.String values? #319

@rcoreilly

Description

@rcoreilly

I would like to be able to eval an expr like this: EnumVal == Enum1 where I've defined ConstVal to be a standard Go const enum type:

//go:generate stringer -type=MyEnums

type MyEnums int

const (
    Enum1 MyEnums = iota
    Enum2 
)

type MyStruct struct {
    EnumVal MyEnums
}

var stru MyStruct

ev := expr.Eval(`EnumVal==Enum1`, stru)

so the string values are available and could be tested against.

Any chance of adding this?

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