Fix subnet health crash on passing invalid flag (#3858)

The custom `String()` function written for the `HealthDataTypeFlag` was
resulting in a crash as it did not contain `\t` character on which the
usage gets split when printing the error message.

Fixed by reusing the `FlagStringer` from cli package, which is used by StringFlag.String() as well.
This commit is contained in:
Shireesh Anjal
2021-11-03 09:32:36 -07:00
committed by GitHub
parent 14303ec6cf
commit 905502e311
+1 -1
View File
@@ -593,7 +593,7 @@ type HealthDataTypeFlag struct {
// String - returns the string to be shown in the help message
func (f HealthDataTypeFlag) String() string {
return fmt.Sprintf("--%s %s", f.Name, f.Usage)
return cli.FlagStringer(f)
}
// GetName - returns the name of the flag