#Enum default value

1 messages · Page 1 of 1 (latest)

glass geyser
#

Can you clarify what you mean? Or what you're trying to do? Enums can't have an empty value, and if an argument has a default value, then it's optional.

south plank
#

Yeah of course. I am trying to consume my enum from a module other than the one that's defined in. When I want to use the enum, I can't just pass in dag.MyEnum to the function because it's not allowed to be a required parameter. So I have to do something like dagger.MyModuleMyFunctionOpts{ MyEnum: dagger.MyEnum} instead of passing in function(dagger.MyEnum). I understand if this is a limitation of the current implementation but it's not documented. It took me a while to figure that out.

glass geyser
#

No, \\ +optional is supposed to work, with *dagger.MyEnum (pointer). Doesn’t it work?

south plank
#

optional works. Making it non-optional (required), does not work.

glass geyser
#

Required should also work, we have tests for that (iirc). Can you give a simple example of what you’re trying to do?

south plank
#

Sure! Let me try to put something together