Add comment about commaWhitespace stripping of flag.Name
This commit is contained in:
parent
42bdb31055
commit
2b288769c7
4
flag.go
4
flag.go
@ -614,6 +614,10 @@ func flagNames(f Flag) []string {
|
|||||||
aliases := flagStringSliceField(f, "Aliases")
|
aliases := flagStringSliceField(f, "Aliases")
|
||||||
|
|
||||||
for _, part := range append([]string{name}, aliases...) {
|
for _, part := range append([]string{name}, aliases...) {
|
||||||
|
// v1 -> v2 migration warning zone:
|
||||||
|
// Strip off anything after the first found comma or space, which
|
||||||
|
// *hopefully* makes it a tiny bit more obvious that unexpected behavior is
|
||||||
|
// caused by using the v1 form of stringly typed "Name".
|
||||||
ret = append(ret, commaWhitespace.ReplaceAllString(part, ""))
|
ret = append(ret, commaWhitespace.ReplaceAllString(part, ""))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user