I am trying to generate an enum for a type I defined
type FeeStage int
From this I learned that I can use iota to create an enum based on this type
const(
Stage1 FeeStage = iota
Stage2
Stage3
)
However, manipulating the actual values of the enum is rather cumbersome and error prone
const(
Stage1 FeeStage = iota // 0
Stage2 = iota + 6 // 7
Stage3 = (iota - 3) * 5 // -5
)
Is there a way to automatically convert a list of ENUMs with custom values to a certain type. This is what I was using before but only converts the first member of the constant to the custom type.
const(
Stage1 FeeStage = 1
Stage2 = 2
Stage3 = 2
)
Here is a playground with a similar result