How to tell if a flag was set or not? #1804
Answered
by
dearchap
Integralist
asked this question in
Q&A
-
Hello, Is it possible to tell if a flag has been set or not? For example, a user might want an integer flag value to be zero and so I can't rely on the zero value of an integer to determine if it was sent or not. In Go you typically use a pointer so you can tell if the value was provided vs a zero value. Is there anything like this available? Thanks. |
Beta Was this translation helpful? Give feedback.
Answered by
dearchap
Aug 8, 2023
Replies: 1 comment 1 reply
-
In v2 you can use context.IsSet(flagName) to determine if the flag has been set. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Integralist
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In v2 you can use context.IsSet(flagName) to determine if the flag has been set.