From 905502e3119351fcaae8d78b8417f95bfa3086df Mon Sep 17 00:00:00 2001 From: Shireesh Anjal <355479+anjalshireesh@users.noreply.github.com> Date: Wed, 3 Nov 2021 22:02:36 +0530 Subject: [PATCH] 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. --- cmd/admin-subnet-health.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/admin-subnet-health.go b/cmd/admin-subnet-health.go index a275df7f..b6cec35c 100644 --- a/cmd/admin-subnet-health.go +++ b/cmd/admin-subnet-health.go @@ -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