forked from ogier/pflag
-
Notifications
You must be signed in to change notification settings - Fork 367
Closed
Description
following !429 : an unfortunate discrepancy landed in the order of arguments for the new functions .BoolFunc() and .Func():
// BoolFunc:
func (f *FlagSet) BoolFunc(name string, usage string, fn func(string) error) {
func (f *FlagSet) BoolFuncP(name, shorthand string, usage string, fn func(string) error) {
func BoolFunc(name string, usage string, fn func(string) error) {
func BoolFuncP(name, shorthand string, fn func(string) error, usage string) { // <- 'fn' value appears before 'usage' string
// Func:
func (f *FlagSet) Func(name string, usage string, fn func(string) error) {
func (f *FlagSet) FuncP(name string, shorthand string, usage string, fn func(string) error) {
func Func(name string, fn func(string) error, usage string) { // <- 'fn' value appears before 'usage' string
func FuncP(name, shorthand string, fn func(string) error, usage string) { // <- 'fn' value appears before 'usage' string
taking the flag package from the stdlib as a reference, the order of arguments should always be name(s), usage, fn. (node: the link to go code reflects the state of master branch on 2025-06-27)
Metadata
Metadata
Assignees
Labels
No labels