-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
spf13/pflag
#381Labels
area/flags-argsChanges to functionality around command line flags and argsChanges to functionality around command line flags and argsgood-first-issueIssues that a new contributor could make a PR forIssues that a new contributor could make a PR forlifecycle/needs-prReady for a PR from the communityReady for a PR from the community
Description
Adding a BoolVarP with shorthand code of "h" to any flagset generates a misleading panic message:
panic: unable to redefine 'h' shorthand in "mapgen" flagset: it's already used for "flag" flag
The error makes it seem like the issue is with the "mapgen" flagset (in this example) when it's actually from the default help flagset.
To recreate, add a BoolVarP to the root command and then run the command with no arguments.
var flag bool
func init() {
rootCmd.Flags().BoolVarP(&flag, "flag", "h", false, "flag")
}
This is with v1.0.5.
Metadata
Metadata
Assignees
Labels
area/flags-argsChanges to functionality around command line flags and argsChanges to functionality around command line flags and argsgood-first-issueIssues that a new contributor could make a PR forIssues that a new contributor could make a PR forlifecycle/needs-prReady for a PR from the communityReady for a PR from the community