-
Notifications
You must be signed in to change notification settings - Fork 17.5k
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
flag: print default value when false for boolean flags #63150
Comments
I would like to pick dev for this if you consider it as a good first issue. |
sure, send a CL / PR |
Please always post ordinary text output as plain text, not as an image. Plain text is much easier to read. Thanks. |
This is intentional behavior. The flag package only displays the default flag when that value is not the zero value of the type. The code is at https://go.googlesource.com/go/+/refs/heads/master/src/flag/flag.go#628. Thanks for reporting this but we don't plan to change it. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I defined a boolean flag with default value as false.
flag.Bool("boolVar", false, "Trying bool variable")
I'm running go run main.go -h
What did you expect to see?
I expect to get default value of boolVar like I get when it's true.
What did you see instead?
I'm not getting default value when it's false.
The text was updated successfully, but these errors were encountered: