Skip to content
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

cli: poor messaging on misconfigured duration flag #163

Open
nnchang opened this issue Jun 25, 2019 · 0 comments
Open

cli: poor messaging on misconfigured duration flag #163

nnchang opened this issue Jun 25, 2019 · 0 comments

Comments

@nnchang
Copy link

nnchang commented Jun 25, 2019

If I have a cli with a duration flag that is not required and has no default, it will always panic with the message:

panic: time: invalid duration

this happens whether or not the user provides a value on the command line. Turns out this panic arises in the default-parsing code:

func (f DurationFlag) Default() interface{} {
dur, err := f.Parse(f.DefaultStr())
if err != nil {
panic(err)

We should have better messaging to ensure developers aren't confused when the panic happens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant