4 ms·
It matters if there's no way to have a flag without a default. If your flag doesn't have a clear "user didn't supply anything" default it can be annoying
by openasocket 9y ago
It matters if there's no way to have a flag without a default. If your flag doesn't have a clear "user didn't supply anything" default it can be annoying
- ecnahc515 9y agoIt's always possible to define a custom flag type to handle this. It's definitely what I would consider niche however, since usually you don't care about set/unset just whatever the value is, default or not.
- spyspy 9y agoI've done something like this before: > id = flag.Int64("id", -1, "ID of the thing I want") Obviously that doesn't work for booleans, but you could take the boolean input as a string and then use strconv.ParseBool