-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make UNSET enums' String() return "UNSET" #436
base: master
Are you sure you want to change the base?
Conversation
Actually, I think UNSET might be better, since it might be used for logging. Seeing |
There was the intention to make the default value of an enumeration be the 0 value in the case that a default was specified for the leaf -- is that currently not-operational? If so, it would mean that |
Since Line 287 in c6ce7e5
If we have a typedef enum used in multiple places, then in order to stream the correct default value, |
#172 confirms that this is not in operation in Go. It is also of dubious operation in proto due to the possibility of re-uses of enum typedefs. I think the question of how we're going to support default values in Go needs to be answered first before the concern raised in this PR can be answered. |
Returning this message for UNSET seems rather excessive, as reflected by a user:
fmt.Sprintf("out-of-range %s enum value: %v", enumTypeName, val)
Since all UNSET values are currently 0, we can just use this fact to return "UNSET" if they're not found within the enum map.